systemctl mongod 之后退出

systemctl mongod 之后退出

我正在使用 运行 mongo 守护进程systemctl start mongod。当它工作几个小时时,守护进程将变为活动状态(退出)。没有抛出错误,我也找不到原因。有人知道出了什么问题吗?

我运行时的输出systemctl status mongod

mongod.service - SYSV: Mongo is a scalable, document-oriented database.
Loaded: loaded (/etc/rc.d/init.d/mongod; bad; vendor preset: disabled)
Active: active (exited) since Wed 2017-08-30 19:28:20 +08; 3h 58min ago
Docs: man:systemd-sysv-generator(8)
Process: 11812 ExecStop=/etc/rc.d/init.d/mongod stop (code=exited, 
status=0/SUCCESS)
Process: 11837 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=0/SUCCESS)

Aug 30 19:28:14 example.com systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database....
Aug 30 19:28:14 example.com runuser[11844]: pam_unix(runuser:session): session opened for user mongod by (uid=0)
Aug 30 19:28:20 example.com runuser[11844]: pam_unix(runuser:session): session closed for user mongod
Aug 30 19:28:20 example.com mongod[11837]: Starting mongod: [  OK  ]
Aug 30 19:28:20 example.com systemd[1]: Started SYSV: Mongo is a 
scalable, document-oriented database..

我运行时的输出journalctl -u mongod

-- Logs begin at Wed 2017-08-30 13:39:42 +08, end at Wed 2017-08-30 23:51:34 +08. --
Aug 30 13:40:08 example.com systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database....
Aug 30 13:40:08 example.com runuser[2861]: pam_unix(runuser:session): session opened for user mongod by (uid=0)
Aug 30 13:40:11 example.com mongod[2846]: Starting mongod: [  OK  ]
Aug 30 13:40:11 example.com systemd[1]: Started SYSV: Mongo is a scalable, document-oriented database..
Aug 30 19:28:13 example.com systemd[1]: Stopping SYSV: Mongo is a scalable, document-oriented database....
Aug 30 19:28:14 example.com mongod[11812]: Stopping mongod: [  OK  ]
Aug 30 19:28:14 example.com systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database....
Aug 30 19:28:14 example.com runuser[11844]: pam_unix(runuser:session): session opened for user mongod by (uid=0)
Aug 30 19:28:20 example.com runuser[11844]: pam_unix(runuser:session): session closed for user mongod
Aug 30 19:28:20 example.com mongod[11837]: Starting mongod: [  OK  ]
Aug 30 19:28:20 example.com systemd[1]: Started SYSV: Mongo is a scalable, document-oriented database..

答案1

问题的一个潜在来源是您正在使用 system 来启动服务,但您使用的是旧的 SysVinit 脚本,而不是使用 systemd 单元文件。

这可能表明您正在使用旧版本的 MongoDB,或者您的新版本的 MongoDB 配置错误。

确认您使用的 MongoDB 版本并检查/lib/systemd/system/mongod.service您的系统上是否安装了该版本。

切换到使用 systemd 单元文件来管理服务可能无法解决崩溃问题,但它肯定会简化您的配置,并且可能使剩余的故障排除变得更加容易。

相关内容