Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoD doesn't stop on CentOS

I try to shutdown mongoD in order to make a backup. However when I send service mongod stop it totally failed Stopping mongod:[FAILED]

I took a look on mongodb logs and there is nothing about shutdown...

I've got important data on this DB and i don't want to kill anything, so as i'm a beginner in mongoDB, I prefer to ask here what to do before destroy everything.

I was thinking about kill the process of MongoD, make my backup with mongodump and restart MongoD, but i'm not sure that it will work.

Thanks for helping.

like image 384
user3684398 Avatar asked Mar 18 '23 14:03

user3684398


1 Answers

For my MongoDB 3.0 install, the problem with stopping was caused by a comment field in the /etc/mongod.conf file:

pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile

This caused a problem with the awk command in /etc/init.d/mongod that defines the PIDFILEPATH since the comment text became part of the path, which then meant the mongo_killproc would not work.

I fixed this by editing the mongod.conf to move the comment to a separate line and now all is good (I did not have to change the quotes around $PIDFILEPATH either)

like image 79
David I Avatar answered Apr 02 '23 09:04

David I