I have installed mongodb and when i typing the following command i am getting these messages
root@amila:~# service mongodb status
mongodb stop/waiting
root@amila:~# service mongodb restart
restart: Unknown instance:
root@amila:~# service mongodb stop
stop: Unknown instance:
I want to restart mongodb.but unable to restart.
EDIT:
here is the /etc/mongodb.conf
dbpath=/var/lib/mongodb
logpath=/var/log/mongodb/mongodb.log
logappend=true
bind_ip = 127.0.0.1
auth = true
Best Answer
Given the output of the start command, this is starting correctly. When you are running status, it seems to have been stopped. You need to look into the log file:
That will tell you why the mongod is stopping. There are a couple of likely causes, but without seeing that output it will be hard to answer definitively. My general recommendations:
Do not use bind_ip - it is a bad idea in generalUpdate (2016): Removing this because the issues with bind_ip that caused me to write this back in 2012 have been fixed, and it is even on by default in official packages now. Worth trying without the setting as a troubleshooting step, but not a bad idea to use it in general.Finally, take a look at this answer for how to fix file permissions, just in case that is a problem (usually caused by running as root at some point):
mongodb crashes after unexpected shutdown