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
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:
/var/log/mongodb/mongodb.log
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:
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
Sorry if you consider this "SO archeology".
I don't know if this is the same issue, but I'm facing something similiar right now. End of my log:
Mon Nov 19 10:25:37 [initandlisten] exception in initAndListen: 12596 old lock file, terminating
Mon Nov 19 10:25:37 dbexit:
Mon Nov 19 10:25:37 [initandlisten] shutdown: going to close listening sockets...
Mon Nov 19 10:25:37 [initandlisten] shutdown: going to flush diaglog...
Mon Nov 19 10:25:37 [initandlisten] shutdown: going to close sockets...
Mon Nov 19 10:25:37 [initandlisten] shutdown: waiting for fs preallocator...
Mon Nov 19 10:25:37 [initandlisten] shutdown: lock for final commit...
Mon Nov 19 10:25:37 [initandlisten] shutdown: final commit...
Mon Nov 19 10:25:37 [initandlisten] shutdown: closing all files...
Mon Nov 19 10:25:37 [initandlisten] closeAllFiles() finished
Mon Nov 19 10:25:37 dbexit: really exiting now
So I think the lock file is not closed properly (for example when shutting down). You should use
mongod --repair
But it didn't work for me, so I just removed /var/lib/mongodb/mongod.lock
and then started the server. This is not the secure way, and there is possibility, that data in your database is corrupt if you do so.
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