Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB not using /etc/mongodb.conf after I changed dbpath

Tags:

mongodb

Ever since I changed the dbpath in /etc/mongodb.conf, MongoDB has not been starting automatically, nor using the new dbpath. Prior to the change, MongoDB would be running when the computer started and I was able to simply run the command mongo to get into the console or start my Ruby on Rails server with no issues.

After I made the modification (in order to switch to a new drive with more space), the only way I can get everything to work is by manually running the command mongod --config /etc/mongodb.conf. If I don't run that, it doesn't seem like the service is running and running without the --config option give me the following error: ERROR: dbpath (/data/db/) does not exist. even though the config file says nothing about data/db.

Some other notes:

  • In addition to changing /etc/mongodb.conf, I moved all files out of /var/lib/mongodb and into /home/nick/appdev/mongodb.
  • I changed the owner and group from root to nick. Tried changing it back, but it didn't seem to fix anything.
  • I'm running Ubuntu 12.10 Beta 1 and Mongo 2.2.0 with Ruby on Rails 3.2.8
like image 846
Nick Avatar asked Sep 24 '12 16:09

Nick


1 Answers

A late follow up on the above question...

I had a similar issue after moving the db to an ebs on ec2.

It turns out that just running mongod still directs the dbpath to /data/db/ (which exists).

The /etc/mongodb.conf is completely ignored unless specifically directed to.

I manage to work around this by using the directive --config or just the --dbpath(both work) But was left wondering where does mongod takes it defaults from...?!

I was unable to locate and override these defaults anywhere. Anyone ?

Note: I am really annoyed by this behaviour of mongod...This is just bad design,and bad documentation.

like image 179
kman Avatar answered Oct 21 '22 23:10

kman