1

问题:按照官方指南所示安装了 Repo 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.
4

3 回答 3

2

正如其他答案已经说明的那样,问题是mongod.pidsystemd 在其他地方期望的文件。在软件包修复之前,我找到了解决这个问题的最佳方法,即更改 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
于 2013-11-08T11:45:45.670 回答
1

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

于 2013-09-06T10:59:57.590 回答
0

正如上面所说的

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

所以你可以创建目录并以root身份/var/run/mongo复制到它:mongodb.pid

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

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

于 2013-10-16T01:56:30.070 回答