折腾:
【已解决】CentOS中如何查看Mongod的server的运行情况
期间,用:
service mongod status
发现mongod的状态,虽然是active,但是却是existed:
<code>[root@xxx-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 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 x-general-01 systemd[1]: Started SYSV: Mongo is a scalable, document-oriented database.. </code>
而正常的情况应该是:
MongoDB – Commands to Check the Status of MongoDB Database – Reskilling IT
中的:
active running
才对。
没见过这种情况,想要搞清楚是什么意思,怎么变成:active但是却existed的
CentOS mongod active existed what meaning
mongod status active but existed
mongodb – mongo shell working in UBUNTU but ‘mongod start’ doesn’t work? – Stack Overflow
mongodb – Error “mongod dead but pid file exists” – Stack Overflow
去查看日志
<code>[root@x-general-01 logs]# cd /var/log/mongodb/ [root@xx-general-01 mongodb]# ll total 18588 -rw-r----- 1 mongod mongod 19027088 Aug 28 10:48 mongod.log [root@x-general-01 mongodb]# tail mongod.log 2018-08-28T10:48:22.538+0800 I ACCESS [conn57691] Successfully authenticated as principal gridfs on gridfs 2018-08-28T10:48:22.600+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38032 #57692 (27 connections now open) 2018-08-28T10:48:22.632+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38036 #57693 (28 connections now open) 2018-08-28T10:48:22.643+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38038 #57694 (29 connections now open) 2018-08-28T10:48:22.662+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38048 #57695 (30 connections now open) 2018-08-28T10:48:22.665+0800 I ACCESS [conn57693] Successfully authenticated as principal gridfs on gridfs 2018-08-28T10:48:22.684+0800 I ACCESS [conn57695] Successfully authenticated as principal gridfs on gridfs 2018-08-28T10:48:22.740+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38052 #57696 (31 connections now open) 2018-08-28T10:48:22.770+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38058 #57697 (32 connections now open) 2018-08-28T10:48:22.812+0800 I ACCESS [conn57697] Successfully authenticated as principal gridfs on gridfs [root@xx-general-01 mongodb]# tail -n 30 mongod.log 2018-08-28T10:47:56.158+0800 I NETWORK [conn57666] end connection 127.0.0.1:37948 (16 connections now open) 2018-08-28T10:47:56.175+0800 I NETWORK [conn57665] end connection 127.0.0.1:37946 (15 connections now open) 2018-08-28T10:47:56.176+0800 I NETWORK [conn57664] end connection 127.0.0.1:37944 (14 connections now open) 2018-08-28T10:48:21.926+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38002 #57680 (15 connections now open) 2018-08-28T10:48:21.996+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38004 #57681 (16 connections now open) 2018-08-28T10:48:22.024+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38006 #57682 (17 connections now open) 2018-08-28T10:48:22.064+0800 I ACCESS [conn57681] Successfully authenticated as principal gridfs on gridfs 2018-08-28T10:48:22.103+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38008 #57683 (18 connections now open) 2018-08-28T10:48:22.103+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38010 #57684 (19 connections now open) 2018-08-28T10:48:22.144+0800 I ACCESS [conn57683] Successfully authenticated as principal gridfs on gridfs 2018-08-28T10:48:22.164+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38012 #57685 (20 connections now open) 2018-08-28T10:48:22.173+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38014 #57686 (21 connections now open) 2018-08-28T10:48:22.227+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38016 #57687 (22 connections now open) 2018-08-28T10:48:22.228+0800 I ACCESS [conn57685] Successfully authenticated as principal gridfs on gridfs 2018-08-28T10:48:22.296+0800 I ACCESS [conn57687] Successfully authenticated as principal gridfs on gridfs 2018-08-28T10:48:22.465+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38022 #57688 (23 connections now open) 2018-08-28T10:48:22.483+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38024 #57689 (24 connections now open) 2018-08-28T10:48:22.487+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38028 #57690 (25 connections now open) 2018-08-28T10:48:22.498+0800 I ACCESS [conn57690] Successfully authenticated as principal gridfs on gridfs 2018-08-28T10:48:22.507+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38030 #57691 (26 connections now open) 2018-08-28T10:48:22.538+0800 I ACCESS [conn57691] Successfully authenticated as principal gridfs on gridfs 2018-08-28T10:48:22.600+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38032 #57692 (27 connections now open) 2018-08-28T10:48:22.632+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38036 #57693 (28 connections now open) 2018-08-28T10:48:22.643+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38038 #57694 (29 connections now open) 2018-08-28T10:48:22.662+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38048 #57695 (30 connections now open) 2018-08-28T10:48:22.665+0800 I ACCESS [conn57693] Successfully authenticated as principal gridfs on gridfs 2018-08-28T10:48:22.684+0800 I ACCESS [conn57695] Successfully authenticated as principal gridfs on gridfs 2018-08-28T10:48:22.740+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38052 #57696 (31 connections now open) 2018-08-28T10:48:22.770+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:38058 #57697 (32 connections now open) 2018-08-28T10:48:22.812+0800 I ACCESS [conn57697] Successfully authenticated as principal gridfs on gridfs [root@xx-general-01 mongodb]# </code>
看起来好像是正常工作的:
对于刚才的gridfs,貌似是正常连接的?
Mongodb not working on Ubuntu 16.04 – Stack Overflow
Running mongodb on ubuntu 16.04 LTS – Stack Overflow
Mongodb not able to start in Ubuntu 15.04 – Stack Overflow
mongodb status active exited
mongodb active (exited)
mongod active (exited)
mongo active (exited)
upstart – Run MongoDB service as daemon of SystemD on Ubuntu 15.10 – Ask Ubuntu
MongoDB重装后无法启动的一个可能原因 – CSDN博客
别人都没遇到:
active (exited)
算了,那就重启mongod算了
<code>[root@x-general-01 mongodb]# systemctl restart mongod [root@x-general-01 mongodb]# 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 (running) since Tue 2018-08-28 11:40:44 CST; 2s ago Docs: man:systemd-sysv-generator(8) Process: 15883 ExecStop=/etc/rc.d/init.d/mongod stop (code=exited, status=0/SUCCESS) Process: 15900 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=0/SUCCESS) CGroup: /system.slice/mongod.service └─15915 /usr/bin/mongod -f /etc/mongod.conf Aug 28 11:40:43 x-general-01 systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database.... Aug 28 11:40:43 x-general-01 runuser[15911]: pam_unix(runuser:session): session opened for user mongod by (uid=0) Aug 28 11:40:44 x-general-01 runuser[15911]: pam_unix(runuser:session): session closed for user mongod Aug 28 11:40:44 x-general-01 mongod[15900]: Starting mongod: [ OK ] Aug 28 11:40:44 x-general-01 systemd[1]: Started SYSV: Mongo is a scalable, document-oriented database.. </code>
可以看到重启mongod后,状态就是正常的:
<code>Active: active (running) </code>
了。
【总结】
所以此处也找不到别人有
mongod的status是:
<code>Active: active (exited) </code>
最后自己此处只能重启mongod:
<code>systemctl restart mongod </code>
再去查看状态:
<code>systemctl status mongod </code>
就是正常的:
<code>Active: active (running) </code>
了。