我刚刚在ubuntu 14.0.4上安装了mongoDB. 我试图启动外壳程序,但出现连接拒绝错误.
I just installed mongoDB on ubuntu 14.0.4. I tried to start the shell but I'm getting a connection refused error.
me@medev:/etc/init.d$ mongo MongoDB shell version: 2.6.5 connecting to: test 2014-11-10T15:06:28.084-0500 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused 2014-11-10T15:06:28.085-0500 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因此,我决定尝试重新启动服务,但这也失败了.我收到以下错误消息:
So I decided to try to restart the service but that's failing too. I get the following error message:
me@medev:/etc/init.d$ sudo service mongodb restart mongodb: unrecognized service me@medev:/etc/init.d$这就是我的/var/log/mongodb/mongod.log中的内容- pastebin/MrHt8tce
This is what I have in my /var/log/mongodb/mongod.log - pastebin/MrHt8tce
到目前为止我已经尝试过:
我在这里找到了另一篇文章:无法以sudo的身份启动mongodb 发表了关于删除mongo锁定文件的评论.
I found another post here: can't start mongodb as sudo which made a comment about remove the mongo lock file.
我删除了锁定文件,然后重试了我的命令,但是它仍然失败,如下所示:
I deleted the lock file and then retried my command but it still fails as you can see below:
me@medev:/var/lib/mongodb$ sudo rm mongod.lock me@medev:/var/lib/mongodb$ ls journal local.0 local.ns _tmp me@medev:/var/lib/mongodb$ sudo service mongodb start mongodb: unrecognized service但是我可以使用/etc/init.d来启动它,如下所示:
But I can start it using /etc/init.d as you can see below:
me@medev:/var/lib/mongodb$ sudo /etc/init.d/mongod start Rather than invoking init scripts through /etc/init.d, use the service(8) utility, e.g. service mongod start Since the script you are attempting to invoke has been converted to an Upstart job, you may also use the start(8) utility, e.g. start mongod mongod start/running, process 27469 me@medev:/var/lib/mongodb$ ls journal local.0 local.ns mongod.lock me@medev:/var/lib/mongodb$ mongo MongoDB shell version: 2.6.5 connecting to: test > db test >任何关于为什么我无法使用service命令启动它的想法都将不胜感激.根据我的阅读,我应该使用sudo服务mongodb
Any ideas on why I can't start it using the service command would be appreciated. From what I've read, i should be using sudo service mongodb
推荐答案尝试一下:
写mongodb而不是mongod
sudo service mongodb status更多推荐
sudo服务mongodb重新启动会给出“无法识别的服务错误".在Ubuntu 14.0.4中
发布评论