04上重新启动mongodb

04上重新启动mongodb

本文介绍了无法在Ubuntu 11.04上重新启动mongodb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了mongodb,当我输入以下命令时,我会收到这些消息

I have installed mongodb and when i typing the following command i am getting these messages

root@amila:~# service mongodb status
mongodb stop/waiting
root@amila:~# service mongodb restart
restart: Unknown instance:
root@amila:~# service mongodb stop
stop: Unknown instance:

我想重新启动mongodb.但无法重新启动.

I want to restart mongodb.but unable to restart.

这是/etc/mongodb.conf

here is the /etc/mongodb.conf

dbpath =/var/lib/mongodblogpath =/var/log/mongodb/mongodb.log

dbpath=/var/lib/mongodblogpath=/var/log/mongodb/mongodb.log

logappend = true

logappend=true

bind_ip = 127.0.0.1
auth = true

bind_ip = 127.0.0.1
auth = true

推荐答案

给出start命令的输出,它可以正确启动.当您处于运行状态时,它似乎已经停止了.您需要查看日志文件:

Given the output of the start command, this is starting correctly. When you are running status, it seems to have been stopped. You need to look into the log file:

/var/log/mongodb/mongodb.log

这将告诉您为什么蒙古人停下来.有两种可能的原因,但是如果没有看到输出结果,将很难确定答案.我的一般建议:

That will tell you why the mongod is stopping. There are a couple of likely causes, but without seeing that output it will be hard to answer definitively. My general recommendations:

  1. 更新(2016):删除此问题是因为bind_ip的问题已导致我在2012年写回此问题,并且已得到修复.即使是默认情况下,现在也已正式启用.值得尝试的是不使用此设置作为故障排除步骤,但通常使用它不是一个坏主意.
  2. 检查端口27017上是否还有其他运行
  3. 即使您要使用默认端口,也要在mongodb.conf文件中明确指定端口
  1. Update (2016): Removing this because the issues with bind_ip that caused me to write this back in 2012 have been fixed, and it is even on by default in official packages now. Worth trying without the setting as a troubleshooting step, but not a bad idea to use it in general.
  2. Check for something else running on port 27017
  3. Specify the port explicitly in the mongodb.conf file, even if you want to use the default

最后,看看如何解决文件权限的以下答案,以防万一这是一个问题(通常是由于在某些时候以root用户身份运行引起的):

Finally, take a look at this answer for how to fix file permissions, just in case that is a problem (usually caused by running as root at some point):

mongodb在意外关闭后崩溃

这篇关于无法在Ubuntu 11.04上重新启动mongodb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 05:50