刚刚在 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
/var/log/mongo/mongod.log
中的Mongo日志为空
谢谢
最佳答案
如何在 fedora linux 上安装 mongodb 和 mongodb-server(在 f16 和 f17 上验证)。所有命令都旨在在 su session 中运行。
1) 确保您没有安装 mongodb
# yum erase mongodb
# yum erase mongo-10gen (if it is installed)
2) 从 fedora yum 存储库安装
# 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
这应该会成功完成初始化并让守护程序处于运行状态。
关于linux - MongoDB 服务未在 Fedora 中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11081822/