Search code examples
phpmongodbphp-mongodbnosql

Change MongoDB sizeOnDisk when i create a new database


I used PHP to create MongoDB database. My problem is that every time I create a database, the database's "size on disk" is some 200MB. I want to reduce it down to 25-50MB every time.

I have tried to use "command" and look in the .conf file for MongoDB without luck.

I run CentOS 6.2 if it helps.


Solution

  • If you run the command mongod --help you will see various options you can add when you start-up MongoDB. Two you may want to research are:

      --noprealloc                disable data file preallocation - will often hurt
                                  performance
      --smallfiles                use a smaller default file size