読者です 読者をやめる 読者になる 読者になる

TakayukiKoyama Geek Blog

Create, Entertain, Experience

Mongodbの起動時エラー解決「ERROR: child process failed, exited with error number 100」

 以下のエラーが発生したときの解決策

$ sudo mongod --fork --logpath /opt/mongodb/log/mongodb.log --nojournal --noprealloc --dbpath /opt/mongodb/db
note: noprealloc may hurt performance in many applications
about to fork child process, waiting until server is ready for connections.
forked process: 1046
all output going to: /opt/mongodb/log/mongodb.log
log file [/opt/mongodb/log/mongodb.log] exists; copied to temporary file [/opt/mongodb/log/mongodb.log.2016-04-12T23-18-24]
ERROR: child process failed, exited with error number 100

 「--repair」オプションをつけて修復を試みる。

$ sudo mongod --fork --logpath /opt/mongodb/log/mongodb.log --nojournal --noprealloc --dbpath /opt/mongodb/db --repair
note: noprealloc may hurt performance in many applications
about to fork child process, waiting until server is ready for connections.
forked process: 1062
all output going to: /opt/mongodb/log/mongodb.log
log file [/opt/mongodb/log/mongodb.log] exists; copied to temporary file [/opt/mongodb/log/mongodb.log.2016-04-12T23-20-22]
child process started successfully, parent exiting

 もう一度同じコマンドを叩く

$ sudo mongod --fork --logpath /opt/mongodb/log/mongodb.log --nojournal --noprealloc --dbpath /opt/mongodb/db
note: noprealloc may hurt performance in many applications
about to fork child process, waiting until server is ready for connections.
forked process: 1072
all output going to: /opt/mongodb/log/mongodb.log
log file [/opt/mongodb/log/mongodb.log] exists; copied to temporary file [/opt/mongodb/log/mongodb.log.2016-04-12T23-21-33]
child process started successfully, parent exiting

$ mongo
MongoDB shell version: 2.4.13
connecting to: test
Server has startup warnings:
Wed Apr 13 08:21:33.084 [initandlisten]
Wed Apr 13 08:21:33.084 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
>

 終わり。Macで強制終了したときとかに発生するので、そのときはこのコマンドでMongoを復帰させる。それにしてもMac調子悪い。

参考:  Mongodb service wont start - Stack Overflow