sudo服务mongodb重新启动会给出“无法识别的服务错误".在Ubuntu 14.0.4中 [英] sudo service mongodb restart gives "unrecognized service error" in ubuntu 14.0.4

查看:216
本文介绍了sudo服务mongodb重新启动会给出“无法识别的服务错误".在Ubuntu 14.0.4中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在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中的内容- http://pastebin.com/MrHt8tce

This is what I have in my /var/log/mongodb/mongod.log - http://pastebin.com/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中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆