Linux下MongoDB非正常关闭启动异常解决方法
1、将配置信息写入一个文件中
vim mongo.conf
里面写如下内容:
dbpath=/usr/local/mongodb/data/
logpath=/usr/local/mongodb/logs/mongodb.log
logappend=true
port=27017
fork=true
2、启动mongod
/usr/local/mongodb/bin/mongod -f /usr/local/mongodb/mongo.conf
报错:
about to fork child process, waiting until server is ready for connections.
forked process: 15935
ERROR: child process failed, exited with error number 1
3、解决办法:
1、删除dbpath路径下*.lock文件
2、修复 /usr/local/bin/mongod --repair --dbpath=/usr/local/mongodb/data/
3、再次启动
博主文章同步发布:https://blog.csdn.net/u010647035/article/details/83959552