刚刚在Fedora 17 64位上安装了一个干净版的mongodb,但是Mongo服务不会运行。
我在安装期间跟随these instructions
正在运行
service mongod start
结果
Starting mongod (via systemctl): Job failed. See system journal and 'systemctl status' for details. [FAILED]
所以我跑了
systemctl status mongod.service
给了我
mongod.service - SYSV: Mongo is a scalable, document-oriented database.
Loaded: loaded (/etc/rc.d/init.d/mongod)
Active: failed (Result: exit-code) since Mon, 18 Jun 2012 13:15:56 +0200; 58s ago
Process: 13584 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/mongod.service
Mongo登录/var/log/mongo/mongod.log
为空
由于
答案 0 :(得分:57)
如何在fedora linux上安装mongodb和mongodb-server(在f16& f17上验证)。所有命令都打算在su会话中运行。
1)确保你没有安装mongodb
# yum erase mongodb
# yum erase mongo-10gen (if it is installed)
2)从fedora yum repository安装
# yum --disablerepo=* --enablerepo=fedora,updates install mongodb mongodb-server
3)启动mongod(mongodb守护进程)
# systemctl start mongod.service
4)验证mongod正在运行
# systemctl status mongod.service
# tail /var/log/mongodb/mongodb.log
# nmap -p27017 localhost
或正在运行的客户端
# mongo
MongoDB shell version: 2.0.2
connecting to: test
> db.test.save( { a: 1 } )
> db.test.find()
{ "_id" : ObjectId("4fdf28f09d16204d66082fa3"), "a" : 1 }
5)自定义配置
# vim /etc/mongodb.conf
# systemctl restart mongod.service
6)使mongodb服务在启动时自动启动
# systemctl enable mongod.service
Fedora 18的更新
在慢速或加载的计算机上第一次由systemd启动时,mongod服务可能会在完成初始化之前超时,systemd会将服务标记为失败。
症状:
# journalctl -xn
-- Unit mongod.service has begun starting up.
10:38:43 local mongod[24558]: forked process: 24560
10:38:43 local mongod[24558]: all output going to: /var/log/mongodb/mongodb.log
10:40:13 local systemd[1]: mongod.service operation timed out. Terminating.
10:40:13 local systemd[1]: Failed to start High-performance, schema-free document-oriented database.
-- Subject: Unit mongod.service has failed
非常容易治愈,重启服务:
# systemctl restart mongod.service
这应该成功完成初始化并使守护进程处于运行状态。
答案 1 :(得分:0)
我只是遇到了同样的问题,就我而言,这是由于按照某些使用非官方回购网站的说明安装mongodb引起的。如果您遇到相同的问题,并且上述答案不能解决问题,请尝试卸载“ mongodb-org”软件包,然后按照官方文档的说明重新安装它:https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/
要在fedora中卸载软件包的其余部分:
sudo dnf remove <package-name>