In my /usr/local/mongodb/mongod.conf
file, I have
# Store data alongside MongoDB instead of the default, /data/db/
dbpath = /usr/local/mongodb_data
# Only accept local connections
bind_ip = 127.0.0.1
But when I try to run Mongo (on my mac), I get an error:
Wed Sep 14 09:29:35 [initandlisten] exception in initAndListen std::exception: dbpath (/data/db/) does not exist, terminating
So apparently the conf file is not being read
If you install MongoDB using brew, the LaunchAgent files that it generates for you will use a configuration file at /usr/local/etc/mongod.conf by default.
This behavior is defined in:
https://github.com/Homebrew/homebrew/blob/master/Library/Formula/mongodb.rb
Note that this "default" only applies when running MongoDB as a service via launchctl
, not manually starting it by running mongodb
.
As of 2015-03-09, the instructions given by Homebrew after installing MongoDB 3.0.0 are:
==> Caveats
To reload mongodb after an upgrade:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
Or, if you don't want/need launchctl, you can just run:
mongod --config /usr/local/etc/mongod.conf
Note the explicit --config
argument in the manual run command.
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