启动mongodb的时候报错:
about to fork child process, waiting until server is ready for connections.
forked process: 17289
ERROR: child process failed, exited with error number 1
To see additional information in this output, start without the "--fork" option.
这算是一个Mongod 启动的一个常见错误,非法关闭的时候,lock 文件没有干掉,第二次启动的时候检查到有lock 文件的时候,就报这个错误了。
解决办法:
- 找到mongodb启动的配置文件内的dbpath内的mongod.lock文件删除掉
- 执行
./bin/mongod --repair -f ./bin/mongod.conf
- 理论上讲,以上步骤完事之后已经可以正常启动了
- 如果还是不行,可以再尝试更换mongod.conf中的logpath,或删除log文件再新建一个
OK,问题解决。
正确关闭mongod 的方法:进入mongo shell
use admin
db.shutdownServer()
请不要 kill -9 ,会造成文件数据混乱丢失 repair 也无力回天。
ctrl+c 可以退出mongo的界面 或是ext
更多推荐
解决启动mongodb --fork报错 -ERROR: child process failed, exited with error number 1
发布评论