刚刚使用
安装mongodbsudo yum install mongodb
但是当我尝试运行'mongo'作为rails应用时,我得到了
[thiago@netbox mongoExample]$ mongo
MongoDB shell version: 2.2.4
connecting to: test
Wed Aug 21 16:07:56 exec error: src/mongo/shell/mongo.js:91 couldn't connect to server 127.0.0.1:27017
db = new Mongo().getDB( url );
^
exception: connect failed
我也尝试过:
[thiago@netbox mongoExample]$ service mongo start
Redirecting to /bin/systemctl start mongo.service
Failed to issue method call: Access denied
[thiago@netbox mongoExample]$ sudo service mongo start
[sudo] password for thiago:
Redirecting to /bin/systemctl start mongo.service
Failed to issue method call: Unit mongo.service failed to load: No such file or directory. See system logs and 'systemctl status mongo.service' for details.
[thiago@netbox mongoExample]$ systemctl status mongo.service
mongo.service
Loaded: error (Reason: No such file or directory)
Active: inactive (dead)
我试着按照他们的文档(http://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat-centos-or-fedora-linux/)没有运气。
我感谢任何帮助。提前谢谢!
答案 0 :(得分:-4)
试试这个,我有同样的问题,并且它通过执行这个命令来工作
sudo systemctl restart mongod.service