Currently I am unable to start mongodb with the usual command sudo service mongodb start. When I do that, I get something like:

mongodb start/running, process 23387

however no such process is subsequently running, and the mongodb log doesn't show anything new. mongodb DOES however start on reboot, and it can be stopped with sudo service mongodb stop.

It's more of an inconvenience than a game stopper, but I'm intrigued - what's going on??


It turned out that start-stop-daemon (used by the init script) is aware of other mongodb instances I was running from a command line. When I stopped these instances, I was able to start my main mongodb normally.

A more permanent solution is to tell start-stop-daemon to create a pid file and check it when determining if mongodb is already running. With my default ubuntu install (1:2.0.6-1ubuntu4), the init script only checks if the mongodb executable is running (look for --exec /usr/bin/mongod in /etc/init/mongodb.conf).

For the record, this thread talks about this issue and this quesion talks about a somewhat similar situation.

| improve this answer | |

Another probability; When we are installing and checking the monggodb by using sudo, mongodb directories can be created by 'root' by mistake.

So, check the directories by using ll /var/lib/mongodb and ll /var/log/mongodb commands.

If the owner appearances as root change the owner as mongodb by using sudo chown mongodb:mongodb /var/lib/mongodb -R

I've experienced!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.