使用systemctl查看报错信息
systemctl status mongod
about to fork child process, waiting until server is ready for
connections. forked process: 15935 ERROR: child process failed, exited
with error number 1
或者直接用命令启动的时候出现报错信息
mongod -f dbpath=xxx/mongod/data
about to fork child process, waiting until server is ready for
connections. forked process: 15935 ERROR: child process failed, exited
with error number 1
解决办法:
1、删除dbpath路径下*.lock文件
如果不知道自己的dapath路径,可以使用
find / -name mongod.conf
文件中会有dapath路径
2、修复命令
/usr/local/bin/mongod --repair --dbpath=/usr/local/mongodb/data/
3、再次启动
如果启动还是有报错,查看mongod的日志
find / -name mongod.log
根据自己的报错信息就可以具体排查问题即可