为什么我不能启动mongodb [英] why can't I start the mongodb

查看:51
本文介绍了为什么我不能启动mongodb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是错误:

(mysite)zjm1126@zjm1126-G41MT-S2:~$ /usr/local/mongodb/bin/mongod 
/usr/local/mongodb/bin/mongod --help for help and startup options
Wed Apr 27 10:02:41 [initandlisten] MongoDB starting : pid=2652 port=27017 dbpath=/data/db/ 32-bit 

** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
**       see http://blog.mongodb.org/post/137788967/32-bit-limitations
**       with --dur, the limit is lower

Wed Apr 27 10:02:41 [initandlisten] db version v1.8.1, pdfile version 4.5
Wed Apr 27 10:02:41 [initandlisten] git version: a429cd4f535b2499cc4130b06ff7c26f41c00f04
Wed Apr 27 10:02:41 [initandlisten] build sys info: Linux bs-linux32.10gen.cc 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_37
Wed Apr 27 10:02:41 [initandlisten] exception in initAndListen std::exception: Unable to create / open lock file for lockfilepath: /data/db/mongod.lock errno:13 Permission denied, terminating
Wed Apr 27 10:02:41 dbexit: 
Wed Apr 27 10:02:41 [initandlisten] shutdown: going to close listening sockets...
Wed Apr 27 10:02:41 [initandlisten] shutdown: going to flush diaglog...
Wed Apr 27 10:02:41 [initandlisten] shutdown: going to close sockets...
Wed Apr 27 10:02:41 [initandlisten] shutdown: waiting for fs preallocator...
Wed Apr 27 10:02:41 [initandlisten] shutdown: closing all files...
Wed Apr 27 10:02:41 closeAllFiles() finished
Wed Apr 27 10:02:41 [initandlisten] shutdown: removing fs lock...
Wed Apr 27 10:02:41 [initandlisten] couldn't remove fs lock errno:9 Bad file descriptor
Wed Apr 27 10:02:41 dbexit: really exiting now

推荐答案

启动MongoDB的用户帐户需要对/data/db/目录具有写权限 ...您可以像这样更改所以...

The user account that is starting MongoDB needs to have write privileges to the /data/db/ directory ... you can change this like so ...

此命令会将/data/db/的所有者更改为所使用的用户帐户.

This command will change the owner of the /data/db/ to the user account being used.

$ sudo chown `id -u` /data/db
$ mongod 

如果启动MongoDB时仍然遇到问题,则需要删除/data/db/mongod.lock,然后对数据库进行修复...

If you still run into problems with MongoDB starting, you need to delete /data/db/mongod.lock and then run repair on your database ...

mongod --repair

有关修复命令的更多信息此处.

More about the repair command here.

这篇关于为什么我不能启动mongodb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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