您好,登錄后才能下訂單哦!
小編給大家分享一下解決linux下啟動mongodb出現錯誤的方法,希望大家閱讀完這篇文章后大所收獲,下面讓我們一起去探討方法吧!
解決linux下啟動mongodb出現錯誤的方法:
根據錯誤信息進入日志文件根據日志文件具體內容中提供的地址獲取到修改方式
刪除日志文件,以repair方式啟動數據庫
然后再啟動一次數據庫,查看進程,如果數據庫進程存在,則修復成功
啟動錯誤:
[root@oracleLinux ~]# service mongod start Starting mongod: Fri Jan 24 09:59:59.385 Fri Jan 24 09:59:59.386 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability. Fri Jan 24 09:59:59.387 about to fork child process, waiting until server is ready for connections. forked process: 2120 all output going to: /var/log/mongo/mongod.log ERROR: child process failed, exited with error number 100
日志文件:
ERROR: child process failed, exited with error number 100
日志文件相關內容:
************** Unclean shutdown detected. Please visit <span>http://dochub.mongodb.org/core/repair</span> for recovery instructions. ************* Thu Jan 23 12:34:11.293 [initandlisten] exception in initAndListen: 12596 old lock file, terminating Thu Jan 23 12:34:11.293 dbexit: Thu Jan 23 12:34:11.293 [initandlisten] shutdown: going to close listening sockets... Thu Jan 23 12:34:11.293 [initandlisten] shutdown: going to flush diaglog... Thu Jan 23 12:34:11.293 [initandlisten] shutdown: going to close sockets... Thu Jan 23 12:34:11.293 [initandlisten] shutdown: waiting for fs preallocator... Thu Jan 23 12:34:11.293 [initandlisten] shutdown: closing all files... Thu Jan 23 12:34:11.293 [initandlisten] closeAllFiles() finished Thu Jan 23 12:34:11.293 dbexit: really exiting now
此處是非法關閉mongodb,根據日子文件具體內容中提供的地址(第3行處)獲取到修復方式。
a、首先刪除/var/lib/mongo/目錄下的mongod.lock文件,具體命令如下:
[root@oracleLinux ~]# rm /var/lib/mongo/mongod.lock
b、已repair方式啟動mongodb,具體命令如下:
[root@oracleLinux mongo]# mongod -f /etc/mongod.conf --repair Fri Jan 24 10:38:39.112 Fri Jan 24 10:38:39.113 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability. Fri Jan 24 10:38:39.114 about to fork child process, waiting until server is ready for connections. forked process: 2237 all output going to: /var/log/mongo/mongod.log child process started successfully, parent exiting
在啟動一次mongodb,具體命令如下:
[root@oracleLinux mongo]# mongod -f /etc/mongod.conf Fri Jan 24 10:41:13.664 Fri Jan 24 10:41:13.665 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability. Fri Jan 24 10:41:13.666 about to fork child process, waiting until server is ready for connections. forked process: 2253 all output going to: /var/log/mongo/mongod.log child process started successfully, parent exiting
查看進程,如果存在mongodb進程,即代表修復成功,具體命令如下:
[root@oracleLinux mongo]# ps -ef | grep mongo root 2253 1 2 10:41 ? 00:00:02 mongod -f /etc/mongod.conf root 2268 2079 0 10:43 pts/0 00:00:00 grep mongo
看完了這篇文章,相信你對解決linux下啟動mongodb出現錯誤的方法有了一定的了解,想了解更多相關知識,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。