折腾:
期间,需要在CentOS中,搞清楚当前的mongo的server:mongod的运行的情况,确保的确是正在,正常,运行的。
centos mongod check status
unix – Is mongodb running? – Stack Overflow
<code>[root@xxx-general-01 logs]# ps aux | grep mongod root 15760 0.0 0.0 112660 976 pts/0 S+ 11:19 0:00 grep --color=auto mongod [root@xx-general-01 logs]# service mongod status ● 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 Mon 2018-05-14 16:42:01 CST; 3 months 14 days ago Docs: man:systemd-sysv-generator(8) May 14 16:41:58 xx-general-01 systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database.... May 14 16:41:58 xx-general-01 runuser[1175]: pam_unix(runuser:session): session opened for user mongod by (uid=0) May 14 16:42:01 xx-general-01 mongod[1140]: Starting mongod: [ OK ] May 14 16:42:01 xx-general-01 systemd[1]: Started SYSV: Mongo is a scalable, document-oriented database.. </code>
怎么status中显示是:active exited啊
<code>[root@xx-general-01 logs]# /etc/init.d/mongod status ● 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 Mon 2018-05-14 16:42:01 CST; 3 months 14 days ago Docs: man:systemd-sysv-generator(8) May 14 16:41:58 x-general-01 systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database.... May 14 16:41:58 x-general-01 runuser[1175]: pam_unix(runuser:session): session opened for user mongod by (uid=0) May 14 16:42:01 x-general-01 mongod[1140]: Starting mongod: [ OK ] May 14 16:42:01 xx-general-01 systemd[1]: Started SYSV: Mongo is a scalable, document-oriented database.. </code>
或:
<code>[root@xx-general-01 logs]# 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 Mon 2018-05-14 16:42:01 CST; 3 months 14 days ago Docs: man:systemd-sysv-generator(8) May 14 16:41:58 xx-general-01 systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database.... May 14 16:41:58 xx-general-01 runuser[1175]: pam_unix(runuser:session): session opened for user mongod by (uid=0) May 14 16:42:01 x-general-01 mongod[1140]: Starting mongod: [ OK ] May 14 16:42:01 x-general-01 systemd[1]: Started SYSV: Mongo is a scalable, document-oriented database.. </code>
所以,是可以现在强制去停掉并重启mongod,但是还是要去搞清楚为何此处mongod为何active但是existed了。
【无需解决】mongod的状态中active但却existed是什么意思
【总结】
本身想要在CentOS中查看Mongo的server:mongod的运行情况,可以:
(1)ps看进程
<code>ps -edaf | grep mongo </code>
(2)用系统服务看详细状态
<code>/etc/init.d/mongod status </code>
等价于:
<code>systemctl status mongod </code>
等价于:
MongoDB version < 2.6:
service mongodb status
MongoDB version >= 2.6
service mongod status