我有一个CentOS机器,我安装mongodb,我希望它总是使用storage.smallFiles设置,所以我去了/etc
,我创建了一个新文件/etc/mongodb.conf
,我添加了以下文本,我保存:
storage: smallFiles: enabled: true
然后我键入:
$ mongod --config /etc/mongodb.conf Unrecognized option: storage.smallFiles.enabled try 'mongod --help' for more information
我按照http://docs.mongodb.org/manual/reference/configuration-options/#storage.smallFiles上的文档进行了操作
smallFiles
在不同版本的MongoDB中,存储选项的配置不同.
MongoDB 3.0-4.0 - docs:
storage: mmapv1: smallFiles: true
请注意,在MongoDB 4.0中不推荐使用MMAPv1存储引擎,并且将在以后的版本中删除它 - docs
MongoDB 2.6 - docs:
storage: smallFiles: true
MongoDB 2.4 - docs:
smallfiles = true
您可以通过对admin
数据库调用此命令来检查您的设置是否已正确设置:
db.runCommand({getCmdLineOpts:1});
您也可以在启动mongod时直接指定它,但这会破坏配置文件的目的:
mongod --config /etc/mongodb.conf --smallFiles