MongoDB Configuration File Locations

configurationmongodb

Some databases search/check multiple locations for configuarion files, if it finds many, it merges and does a priority if same options defined.

Does mongodb search multiple locations for configuration files? (starting as a service, not using –config option)

From searching I know it checks /usr/local/etc/mongod.conf by default.

I am hoping to do is separate my global config and production/development config.

Best Answer

The MongoDB server actually does not search any locations for config files, and there is (as at MongoDB 3.2) no way to specify multiple config files or include config file fragments. There was a feature suggestion for includes discussed (see: SERVER-14911 in the MongoDB issue tracker), but it was decided that includes are not part of standard YAML and configuration management systems are likely the best option.

From searching I know it checks /usr/local/etc/mongod.conf by default.

This is the default provided in the service recipe for the mongodb Homebrew package. The official Linux packages generally use a convention of /etc/mongod.conf.