sudo服务mongodb重新启动会给出“无法识别的服务错误".在Ubuntu 14.0.4中

编程入门 行业动态 更新时间:2024-10-25 08:25:56
本文介绍了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中的内容- 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中

本文发布于:2023-10-27 16:07:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1533875.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重新启动   错误   无法识别   mongodb   sudo

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!