mongodb启动不了:child process failed, exited with error number 100

今天在启动mongodb的时候,发现起不来,报错:child process failed, exited with error number 100然后先去/var/log/mongo/mongod.log 查看启动的日志,发现:

mongodb启动不了:child process failed, exited with error number 100

**************
Unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery instructions.
*************
Sat Apr 20 09:40:31.286 [initandlisten] exception in initAndListen: 12596 old lock file, terminating


看来应该是没有正常关闭mongodb引起的。根据提示的链接去看了下,要以修复的方式启动。
mongodb启动不了:child process failed, exited with error number 100
先删除/var/lib/mongo下的mongod.lock
mongodb启动不了:child process failed, exited with error number 100
然后以repair的模式启动:
mongodb启动不了:child process failed, exited with error number 100
然后接着在启动一次
mongodb启动不了:child process failed, exited with error number 100
现在就可以查看到mongod的进程存在了,可以正常使用了
mongodb启动不了:child process failed, exited with error number 100

那么如何正常关闭mongodb?
可以去看官方文档:
http://docs.mongodb.org/manual/tutorial/manage-mongodb-processes/

先通过shell连上服务器:
mongo
use admin
db.shutdownServer()

或者直接kill -15 <pid>,注意kill -9 可能会导致数据文件损坏