天天看點

mongo無限重新開機伺服器,伺服器重新開機後mongodb程序無法啟動

問題描述

伺服器重新開機後,發現對應的mongodb程序沒有啟動.

問題解決

通過日志分析,有mongodb.lock問題.

原因為:

When you are aware of a mongod instance running without journaling that stops unexpectedly and you’re not running with replication, you should always run the repair operation before starting MongoDB again. If you’re using replication, then restore from a backup and allow replication to perform an initial sync to restore data.

If the mongod.lock file in the data directory specified by dbPath, /data/db by default, is not a zero-byte file, then mongod will refuse to start,

修複方法

http://docs.mongodb.org/manual/tutorial/recover-data-following-unexpected-shutdown/

http://docs.mongodb.org/manual/tutorial/resync-replica-set-member/