原因:MongoDB未正常关闭导致的
解决:
- 找到dbpath里的mongod.lock文件,删除mongod.lock文件;例如(/usr/local/mongodb/data文件中)
- 以管理身份启动:sudo /usr/local/mongodb/bin/mongod --config /usr/local/mongodb/bin/mongodb.conf
[ec2-user@ip-172-31-43-102 bin]$ ./mongod --config /usr/local/mongodb/bin/mongodb.conf about to fork child process, waiting until server is ready for connections. forked process: 4099 ERROR: child process failed, exited with error number 14 To see additional information in this output, start without the "--fork" option. [ec2-user@ip-172-31-43-102 bin]$ sudo su [root@ip-172-31-43-102 bin]# cd /usr/local/mongodb/bin [root@ip-172-31-43-102 bin]# ./mongod --config /usr/local/mongodb/bin/mongodb.conf about to fork child process, waiting until server is ready for connections. forked process: 4131 child process started successfully, parent exiting
- 查看进程是否运行 ps -aux | grep mongod