I have a CentOS machine where I installed mongodb and I want it to always use storage.smallFiles setting, so I went to /etc
and I created a new file /etc/mongodb.conf
where I added the following text and I saved:
storage:
smallFiles:
enabled: true
then I typed:
$ mongod --config /etc/mongodb.conf
Unrecognized option: storage.smallFiles.enabled
try 'mongod --help' for more information
I followed documentation on http://docs.mongodb.org/manual/reference/configuration-options/#storage.smallFiles
The MongoDB configuration file contains settings that are equivalent to the command-line options mongod and mongos. Using a MongoDB configuration file simplifies the management of mongod and mongos options, especially in large-scale deployments.
Easiest way to find the storage engine being used currently in from mongo console. WireTiger Storage engine is being used. to get all the configuration details of wiredTiger.
The configuration for storage option smallFiles
is different for different versions of MongoDB. Note that MMAPv1 storage engine is deprecated in MongoDG v4.0 and removed in MongoDB v4.2 - docs.
MongoDB 3.0–4.0 - docs:
storage:
mmapv1:
smallFiles: true
MongoDB 2.6 - docs:
storage:
smallFiles: true
MongoDB 2.4 - docs:
smallfiles = true
You can check that your setting is properly set by calling this command against admin
database:
db.runCommand({getCmdLineOpts:1});
You can also specify it directly when starting mongod
:
mongod --config /etc/mongodb.conf --smallFiles
If you're a developer, don't have time and is using a VM getting out of space... Just copy, paste and go!
sudo bash -c "echo \"smallfiles=true\" >> /etc/mongodb.conf"
sudo service mongodb restart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With