How to Create a configuration File For MongoDB

这一生的挚爱 提交于 2019-11-28 04:42:12

Unless you have installed a packaged version of MongoDB (for example, using Homebrew or Mac Ports) you will have to create a config file manually, or just pass the appropriate command line parameters when starting up MongoDB.

If you want a commented example of a config file to start with, the mongodb.conf in the Debian/Ubuntu package should be a good starting point. Important options to check are the dbpath and logpath which will likely be different for you.

It would also be worth looking at the Homebrew mongodb formula which includes setting up a LaunchAgent script to manage the mongod service.

Addison

The default path for brew installed mongodb on Mac OS X is /usr/local/etc/mongod.conf

Adam Comerford

Yes, unless you install via a package manager (like apt or yum on Linux) you have to create this manually. Then, When you start mongod you simply need to specify where the config file is, for example:

./mongod -f /path/to/mongod.conf

For how that file should look, just take a look here:

http://docs.mongodb.org/manual/reference/configuration-options/

You can also see the aforementioned Linux config files from the packages on github:

https://github.com/mongodb/mongo/blob/master/rpm/mongod.conf

https://github.com/mongodb/mongo/blob/master/debian/mongodb.conf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!