How to Create a configuration File For MongoDB

Viewed 64437

I have installed mongodb for mac os through 10gen and I have gone through the documentation to do so. Everything seems fine apart from the configuration file. I can not see it in /etc/mongod.config. Do I have to manually create this config file? And if so how can I go about it?

cheers

4 Answers

In the case you installed MongoDB without Homebrew, i.e. downloaded the TGZ package directly from MongoDB Download Center, you will can add the configuration file:

sudo nano /etc/mongod.conf

Please use only spaces (no tabs) in the file and leave a space after the key. For example:

security:
  authorization: enabled
net:
  port: 27017
  bindIp: 0.0.0.0

And then run the instance with the configuration flag:

mongod -f /etc/mongod.conf

I wrote a post about installing MongoDB Community Edition directly from the TGZ archive.

Related