mongodb mongodb无法启动
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4405834/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Mongodb can't start
提问by jargalan
today I updated my Mongo.. mongodb-stable (from 10gen repo)
今天我更新了我的 Mongo .. mongodb-stable(来自 10gen repo)
but my service has down. the following command not working
但我的服务已关闭。以下命令不起作用
$ sudo service mongodb start
$ start: Unknown job: mongodb
even this command not working
即使这个命令不起作用
$ sudo /etc/init.d/mongodb start
$ Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mongodb 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 mongodb
start: Unknown job: mongodb
there is no mongo process running
没有运行 mongo 进程
$ ps -ef|grep mongo
$ user 9689 8121 0 13:01 pts/1 00:00:00 grep --color=auto mongo
log is here
日志在这里
tail /var/log/mongodb/mongodb.log
Fri Dec 10 11:24:35 [conn4] end connection 127.0.0.1:54217
Fri Dec 10 11:25:35 [initandlisten] connection accepted from 127.0.0.1:54229 #5
Fri Dec 10 11:26:25 [initandlisten] connection accepted from 127.0.0.1:54243 #6
Fri Dec 10 11:26:30 [conn6] end connection 127.0.0.1:54243
Fri Dec 10 11:30:13 got kill or ctrl c or hup signal 15 (Terminated), will terminate after current cmd ends
Fri Dec 10 11:30:13 [interruptThread] now exiting
Fri Dec 10 11:30:13 dbexit:
Fri Dec 10 11:30:13 [interruptThread] shutdown: going to close listening sockets...
Fri Dec 10 11:30:13 [interruptThread] closing listening socket: 5
Fri Dec 10 11:30:13 [interruptThread] closing listening socket: 6
Fri Dec 10 11:30:13 [interruptThread] closing listening socket: 7
Fri Dec 10 11:30:13 [interruptThread] closing listening socket: 8
Fri Dec 10 11:30:13 [interruptThread] shutdown: going to flush oplog...
Fri Dec 10 11:30:13 [interruptThread] shutdown: going to close sockets...
Fri Dec 10 11:30:13 [interruptThread] shutdown: waiting for fs preallocator...
Fri Dec 10 11:30:13 [interruptThread] shutdown: closing all files...
Fri Dec 10 11:30:13 closeAllFiles() finished
Fri Dec 10 11:30:13 [interruptThread] shutdown: removing fs lock...
Fri Dec 10 11:30:13 dbexit: really exiting now
for now, I'm running Mongo through this command just for a while, creating process manually
现在,我正在通过此命令运行 Mongo 一段时间,手动创建进程
$ sudo mongod -f /etc/mongodb.conf
any idea? or has anyone updated Mongo-stable via Update manager?
任何的想法?或者有人通过更新管理器更新了 Mongo-stable 吗?
Edits:
编辑:
This mongodb version was v1.6.5 and it seems mongo team released it as stable with a bug. And they fixed it immediately at v1.7.4. You can see the major priority issue.
这个 mongodb 版本是 v1.6.5,似乎 mongo 团队发布了它作为一个稳定的错误。他们立即在 v1.7.4 中修复了它。您可以看到主要的优先事项。
采纳答案by Ankhaa
Bug has been reported and fixed.
错误已报告并修复。
https://jira.mongodb.org/browse/SERVER-2200
https://jira.mongodb.org/browse/SERVER-2200
$ sudo apt-get purge mongodb-stable $ sudo apt-get install mongodb-stable (remove the lock file if present in /var/lib/mongodb) $ sudo init 6
Then edit /etc/init/mongodb.conf removing the line "limit nofile 20000"
然后编辑 /etc/init/mongodb.conf 删除行“limit nofile 20000”
$ sudo vi /etc/init/mongodb.conf $ sudo service mongodb start mongodb start/running, process 2351
Worked.
工作了。
回答by nelsonic
Running Ubuntu 11.10confirm you have the latest version of MongoDB:
运行Ubuntu 11.10确认您拥有最新版本的 MongoDB:
$ mongod --version
db version v2.2.0
$ mongod --version
数据库版本 v2.2.0
(If you don't have the latest version of MongoDB, follow the Ubuntu Installation instructionsat: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/)
(如果您没有最新版本的 MongoDB,请按照Ubuntu 安装说明进行操作:http: //docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/)
First confirm that the mongodbuser/group has permission to write to the data directory:
首先确认mongodb用户/组有写入数据目录的权限:
$ sudo chown -R mongodb:mongodb /var/lib/mongodb/.
$ sudo chown -R mongodb:mongodb /var/lib/mongodb/.
Start up MongoDB as a Daemon(background process) using the following command:
使用以下命令将 MongoDB作为守护程序(后台进程)启动:
$ mongod --fork --dbpath /var/lib/mongodb/ --smallfiles --logpath /var/log/mongodb.log --logappend
$ mongod --fork --dbpath /var/lib/mongodb/ --smallfiles --logpath /var/log/mongodb.log --logappend
To Shut Down MongoDBenter the Mongo CLI, access the admin and issue the shutdown command:
要关闭 MongoDB,请进入 Mongo CLI,访问管理员并发出关闭命令:
$ ./mongo
> use admin
> db.shutdownServer()
$ ./mongo
> 使用管理员
> db.shutdownServer()
See: http://www.mongodb.org/display/DOCS/Starting+and+Stopping+Mongo
请参阅:http: //www.mongodb.org/display/DOCS/Starting+and+Stopping+Mongo
回答by DmitrySandalov
In shell launching $ mongo
and # mongo
I was able to find out that
在 shell 启动中$ mongo
,# mongo
我能够发现
/data/db
is not presentsudo mkdir -p /data/db
- mongod is now an upstart
sudo start --system mongod
/data/db
不存在sudo mkdir -p /data/db
- mongod 现在是一个暴发户
sudo start --system mongod
(valid for Ubuntu 14.04 trusty)
(适用于 Ubuntu 14.04 trusty)
回答by francois_k6
I run ubuntu server 10.04 minimal installation in a chroot environment. I always have same massage even after I executed the above. Only the following sudo mongod -f /etc/mongodb.conf
works, any hints?
我在 chroot 环境中运行 ubuntu server 10.04 最小安装。即使在执行上述操作后,我也总是进行相同的按摩。只有以下sudo mongod -f /etc/mongodb.conf
作品,有什么提示吗?
回答by Tilo
you should have mentioned which LINUX distribution and version you are using..
您应该提到您使用的是哪个 LINUX 发行版和版本。
works fine for me on Fedora 13 and 14:
在 Fedora 13 和 14 上对我来说效果很好:
# service mongod status
mongod (pid 6403) is running...
# service mongod stop
Stopping mongod: [ OK ]
# service mongod start
Starting mongod: forked process: 7131
all output going to: /data/mongo/log/mongod.log
[ OK ]
what is the output of " chkconfig | grep mongo " on your system?
您的系统上“chkconfig | grep mongo”的输出是什么?
if you don't get any output from the command above, then you still need to correctly configure mongod as a service with "chkconfig" (see 'man chkconfig')
如果你没有从上面的命令得到任何输出,那么你仍然需要使用“chkconfig”正确地将 mongod 配置为服务(参见“man chkconfig”)
e.g.:
例如:
chkconfig --add mongod
chkconfig --level 35 mongod on
afterwards you should get this output:
之后你应该得到这个输出:
# chkconfig | grep mongo
mongod 0:off 1:off 2:off 3:on 4:off 5:on 6:off
# service mongod status
mongod (pid 6403) is running...
回答by msangel
If process is not running but you still get this exeption - just delete "mongodb.lock" file in your mongodb/data folder
如果进程没有运行但你仍然得到这个例外 - 只需删除 mongodb/data 文件夹中的“mongodb.lock”文件