systemctl status servicename一直显示失败failed,但是对应service已经删除,解决办法
已MongoDB为例。实际上我已经rpm卸载了MongoDB相关的包,查看MongoDB相关命令也没有了
但是一直报下面这个错,重新安装MongoDB也是。后来终于找到解决方法了
执行systemctl reset-failed
[root@instance-u5vn5wqr ~]# systemctl status mongod
● mongod.service
Loaded: not-found (Reason: No such file or directory)
Active: failed (Result: exit-code) since 四 2020-03-26 11:39:56 CST; 14min ago
Main PID: 4304 (code=exited, status=1/FAILURE)
3月 26 11:39:56 instance-u5vn5wqr systemd[1]: Starting MongoDB Database Server...
3月 26 11:39:56 instance-u5vn5wqr mongod[5226]: about to fork child process, waiting until server is ready for connections.
3月 26 11:39:56 instance-u5vn5wqr mongod[5226]: forked process: 5229
3月 26 11:39:56 instance-u5vn5wqr mongod[5226]: ERROR: child process failed, exited with error number 14
3月 26 11:39:56 instance-u5vn5wqr mongod[5226]: To see additional information in this output, start without the "--fork" option.
3月 26 11:39:56 instance-u5vn5wqr systemd[1]: mongod.service: control process exited, code=exited status=14
3月 26 11:39:56 instance-u5vn5wqr systemd[1]: Failed to start MongoDB Database Server.
3月 26 11:39:56 instance-u5vn5wqr systemd[1]: Unit mongod.service entered failed state.
3月 26 11:39:56 instance-u5vn5wqr systemd[1]: mongod.service failed.
[root@instance-u5vn5wqr ~]# systemctl reset-failed
[root@instance-u5vn5wqr ~]# systemctl status mongod
Unit mongod.service could not be found.
终于找不到MongoDB了。恢复正常