简体   繁体   English

无法重新启动mongodb

[英]Cannot restart mongodb

I am trying to restart my mongodb but it has an error 我正在尝试重启我的mongodb,但出现错误

this is the error: 这是错误:

[root@testdb vagrant]# sudo service mongod restart
Stopping mongod:                                           [FAILED]
Starting mongod: warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
about to fork child process, waiting until server is ready for connections.
forked process: 6843
ERROR: child process failed, exited with error number 100
                                                           [FAILED]

my config file is: 我的配置文件是:

bind_ip = 0.0.0.0
dbpath = /var/lib/mongodb
fork = true
logappend = true
logpath = /var/log/mongodb/mongodb.log
nojournal = false
pidfilepath = /var/run/mongodb/mongodb.pid
port = 27017
rest = false
smallfiles = false

this is my log 这是我的日志

在此处输入图片说明

this is the output of ps ax | grep mongod 这是ps ax | grep mongod的输出ps ax | grep mongod ps ax | grep mongod

1935 ?        Sl     1:53 /usr/bin/mongod --config /etc/mongodb.conf
5592 pts/0    S+     0:00 tail -f /var/log/mongodb/mongodb.log
5889 pts/1    S+     0:00 grep mongod

i also removed /var/lib/mongodb/mongod.lock 我还删除了/var/lib/mongodb/mongod.lock

when i restart this is the output stop failed. 当我重新启动这是输出停止失败。

Stopping mongod:                                           [FAILED]
Starting mongod: warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
about to fork child process, waiting until server is ready for connections.
forked process: 5874
child process started successfully, parent exiting
                                                           [  OK  ]

Most likely either a permissions issue or a incorrect shutdown. 最有可能是权限问题或错误关闭。

Run commands sudo rm /var/lib/mongodb/mongod.lock to remove the lock on mongod process then chown the directory to the mongod user using 运行命令sudo rm /var/lib/mongodb/mongod.lock删除对mongod进程的锁定,然后使用以下命令将目录锁定给mongod用户

chown-R mongod: mongod /var/lib/mongo then start service sudo service mongod start chown-R mongod: mongod /var/lib/mongo然后启动服务sudo service mongod start

Before I try and give my input, here is the MongoDB documentation for processes: http://docs.mongodb.org/manual/tutorial/manage-mongodb-processes/#StartingandStoppingMongo-SendingshutdownServer%28%29messagefromthemongoshell 在尝试输入之前,这里是有关进程的MongoDB文档: http : //docs.mongodb.org/manual/tutorial/manage-mongodb-processes/#StartingandStoppingMongo-SendingshutdownServer%28%29messagefromthemongoshell

That being said, trying shutting down the server: 话虽如此,尝试关闭服务器:

use admin
db.shutdownServer()

and starting it again. 然后重新启动。

If you're using linux: 如果您使用的是Linux:

mongod --shutdown

I hope this helped a little, or atleast you can try and use the documentation. 希望对您有所帮助,或者至少可以尝试使用本文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM