Mongod 2.4没有运行Fedora 19冻结

时间:2013-09-03 11:52:49

标签: mongodb installation fedora

问题: 如官方指南Here

所示安装回购

启动mongod后会冻结:

service mongod start
Starting mongod (via systemctl):  

它会像这样停止

添加日志信息

cat /var/log/mongo/mongod.log

Tue Sep  3 14:03:40.431 [initandlisten] MongoDB starting : pid=32320 port=27017 dbpath=/var/lib/mongo 64-bit host=SLI.DOMnet
Tue Sep  3 14:03:40.431 [initandlisten] db version v2.4.6
Tue Sep  3 14:03:40.431 [initandlisten] git version: b9925db5eac369d77a3a5f5d98a145eaaacd9673
Tue Sep  3 14:03:40.431 [initandlisten] build info: Linux ip-10-2-29-40 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
Tue Sep  3 14:03:40.431 [initandlisten] allocator: tcmalloc
Tue Sep  3 14:03:40.431 [initandlisten] options: { config: "/etc/mongod.conf", dbpath: "/var/lib/mongo", fork: "true", logappend: "true", logpath: "/var/log/mongo/mongod.log", pidfilepath: "/var/run/mongodb/mongod.pid" }
Tue Sep  3 14:03:40.444 [initandlisten] journal dir=/var/lib/mongo/journal
Tue Sep  3 14:03:40.444 [initandlisten] recover : no journal files present, no recovery needed
Tue Sep  3 14:03:40.458 [websvr] admin web console waiting for connections on port 28017
Tue Sep  3 14:03:40.458 [initandlisten] waiting for connections on port 27017

正在运行的程序:

ps aux | grep mongo
root      5023  0.0  0.0 112664   932 pts/3    S+   14:06   0:00 grep --color=auto mongo
root     32258  0.0  0.0 113280  1548 pts/0    S+   14:03   0:00 /bin/sh /sbin/service mongod start
root     32304  0.0  0.0 115384  1516 pts/0    S+   14:03   0:00 /bin/bash /etc/init.d/mongod start
root     32310  0.0  0.0 132988  1192 pts/0    S+   14:03   0:00 /bin/systemctl start mongod.service
mongod   32320  0.2  0.2 451772 33772 ?        Sl   14:03   0:00 /usr/bin/mongod -f /etc/mongod.conf

我可以在其他终端上运行mongo但此终端已冻结,经过较长时间后我得到:

 service mongod start
Starting mongod (via systemctl):  Job for mongod.service failed. See 'systemctl status mongod.service' and 'journalctl -xn' for details.                                                          
                                                           [FAILED]

然后程序如下:

ps aux | grep mongo
root     15787  0.0  0.0 112664   928 pts/3    S+   14:10   0:00 grep --color=auto mongo
mongod   32320  0.2  0.2 452800 34316 ?        Sl   14:03   0:00 /usr/bin/mongod -f /etc/mongod.conf

但仍然可以使用mongo控制台。那failed部分呢?

journalctl -xn
-- Logs begin at sob 2013-07-27 13:53:59 CEST, end at wto 2013-09-03 14:08:40 CEST. --
wrz 03 14:03:40  mongod[32312]: Starting mongod: about to fork child process, waiting until server is ready for connections.
wrz 03 14:03:40  mongod[32312]: forked process: 32320
wrz 03 14:03:40  mongod[32312]: all output going to: /var/log/mongo/mongod.log
wrz 03 14:03:40  mongod[32312]: child process started successfully, parent exiting
wrz 03 14:03:40  runuser[32316]: pam_unix(runuser:session): session closed for user mongod
wrz 03 14:03:40  mongod[32312]: [  OK  ]
wrz 03 14:03:40  systemd[1]: PID file /var/run/mongo/mongod.pid not readable (yet?) after start.
wrz 03 14:08:40  systemd[1]: mongod.service operation timed out. Terminating.
wrz 03 14:08:40  systemd[1]: Failed to start SYSV: Mongo is a scalable, document-oriented database..
-- Subject: Unit mongod.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/be02cf6855d2428ba40df7e9d022f03d
-- 
-- Unit mongod.service has failed.
-- 
-- The result is failed.
wrz 03 14:08:40 SLI.DOMnet systemd[1]: Unit mongod.service entered failed state.

3 个答案:

答案 0 :(得分:2)

正如其他答案已经说明的那样,问题是系统在其他地方预期的mongod.pid文件。在修复程序包之前,我发现解决此问题的最佳方法是更改​​mongod配置以在.pid中创建/var/mongo文件(另一种可能是更新systemd单元文件)。

首先,创建/var/mongo

mkdir /var/mongo
chown mongod /var/mongo
chgrp mongod /var/mongo

修改/etc/mongod.conf并按以下方式更新:

# location of pidfile
pidfilepath = /var/run/mongo/mongod.pid

确保mongod未运行,现在它应该能够使用systemctl启动它:

systemctl start mongod

答案 1 :(得分:1)

我发现了这个错误。这是MOngoDB rpm故障。 Mongo正在寻找/var/run/mongo/mongod.pid,路径为/var/run/mongodb/mongodb.pid。希望他们能解决这个问题。至于目前在fedora 18/19中没有解决这个问题。

答案 2 :(得分:0)

正如mSc所说

  

我发现了这个错误。这是MOngoDB rpm故障。 Mongo正在寻找> /var/run/mongo/mongod.pid,路径是/vat/run/mongodb/mongodb.pid。希望他们能够解决这个问题。至于目前在fedora 18/19中没有解决这个问题

因此,您可以创建/var/run/mongo目录并以root身份将mongodb.pid复制到其中:

mkdir /var/run/mongo   
cp /var/run/mongodb/mongodb.pid /var/run/mongo/

我试过并可以在fedora 19中运行mongodb