MongoDB服务无法启动:mongod.service: Failed with result 'exit-code'.
MongoDB无法启动服务
service mongod status ● mongod.service - MongoDB Database Server Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled) Active: failed (Result: exit-code) since Thu 2023-01-12 12:40:21 CET; 5s ago Docs: https://docs.mongodb.org/manual Process: 5502 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=14) Main PID: 5502 (code=exited, status=14) Jan 12 12:40:21 NodeAPP systemd[1]: Started MongoDB Database Server. Jan 12 12:40:21 NodeAPP systemd[1]: mongod.service: Main process exited, code=exited, status=14/n/a Jan 12 12:40:21 NodeAPP systemd[1]: mongod.service: Failed with result 'exit-code'.
解决方法
sudo rm -rf /tmp/mongodb-27017.sock sudo service mongod start
如果依旧不行可以设置.sock
文件和mongodb目录
权限
sudo chown -R mongodb:mongodb /var/lib/mongodb sudo chown mongodb:mongodb /tmp/mongodb-27017.sock