我尝试使用apt-get在Ubuntu Server 14.04上安装mongoDB。
我的命令是sudo apt-get install mongodb-org -y
安装完成后我试图运行sudo service mongod start
输出为mongod start/running, process 11977
尝试获取状态sudo service mongod status
打印出mongod stop/waiting
试图阻止mongod sudo service mongod stop
打印stop: Unknown instance:
当我在命令行中输入mongo
时,我得到了这个
MongoDB shell version: 2.6.3
connecting to: test
2014-08-02T11:49:28.781+0200 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2014-08-02T11:49:28.782+0200 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed
我做错了什么?
答案 0 :(得分:-1)
mongod没有运行,这就是你无法连接的原因。在将其作为服务运行之前,只需从命令行运行mongod并查看它是如何失败的。一旦你开始工作,你就可以转换为服务了。