Linux中MongoDB無法正常啟動的問題解決辦法!__Linux

來源:互聯網
上載者:User

1、報錯,導致mongodb無法正常啟動。具體命令如下(注意紅色字型,提示日誌路徑,可查看該記錄檔):

[root@oracleLinux ~]# service mongod startStarting 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: 2120all output going to: /var/log/mongo/mongod.logERROR: child process failed, exited with error number 100                                                           [失敗]

通過輸出資訊可知,日子檔案為/var/log/mongo/mongod.log
錯誤資訊是:

ERROR: child process failed, exited with error number 100


2、查看mongod.log檔案內容,具體命令如下:

[root@oracleLinux ~]# cat /var/log/mongo/mongod.log 
日誌內容較長,此處截取了相關的內容如下:

************** Unclean shutdown detected.Please visit http://dochub.mongodb.org/core/repair for recovery instructions.*************Thu Jan 23 12:34:11.293 [initandlisten] exception in initAndListen: 12596 old lock file, terminatingThu 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() finishedThu 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 --repairFri 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: 2237all output going to: /var/log/mongo/mongod.logchild process started successfully, parent exiting

c、在啟動一次mongodb,具體命令如下:

[root@oracleLinux mongo]# mongod -f /etc/mongod.confFri 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: 2253all output going to: /var/log/mongo/mongod.logchild process started successfully, parent exiting

d、查看進程,如果存在mongodb進程,即代表修複成功,具體命令如下:

[root@oracleLinux mongo]# ps -ef | grep mongoroot      2253     1  2 10:41 ?        00:00:02 mongod -f /etc/mongod.confroot      2268  2079  0 10:43 pts/0    00:00:00 grep mongo

3、開始使用mongodb,具體命令如下:

[root@oracleLinux mongo]# mongoMongoDB shell version: 2.4.9connecting to: testServer has startup warnings: Fri Jan 24 10:41:13.708 [initandlisten] Fri Jan 24 10:41:13.708 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.Fri Jan 24 10:41:13.708 [initandlisten] **       32 bit builds are limited to less than 2GB of data (or less with --journal).Fri Jan 24 10:41:13.708 [initandlisten] **       Note that journaling defaults to off for 32 bit and is currently off.Fri Jan 24 10:41:13.708 [initandlisten] **       See http://dochub.mongodb.org/core/32bitFri Jan 24 10:41:13.708 [initandlisten] > 










相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.