无法启动mongo db

时间:2011-08-16 13:16:19

标签: mongodb

我正在尝试启动mongo db但是我收到了一个错误   这是输出:

k-ps-macbook:~ kp$ mongod
mongod --help for help and startup options
Tue Aug 16 15:57:11 [initandlisten] MongoDB starting : pid=4143 port=27017 dbpath=/data/db/ 64-bit 
Tue Aug 16 15:57:11 [initandlisten] db version v1.8.2, pdfile version 4.5
Tue Aug 16 15:57:11 [initandlisten] git version: 433bbaa14aaba6860da15bd4de8edf600f56501b
Tue Aug 16 15:57:11 [initandlisten] build sys info: Darwin erh2.10gen.cc 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_40
Tue Aug 16 15:57:11 [initandlisten] couldn't open /data/db/awesome_blog.ns errno:13 Permission denied
Tue Aug 16 15:57:11 [initandlisten] error couldn't open file /data/db/awesome_blog.ns terminating
Tue Aug 16 15:57:11 dbexit: 
Tue Aug 16 15:57:11 [initandlisten] shutdown: going to close listening sockets...
Tue Aug 16 15:57:11 [initandlisten] shutdown: going to flush diaglog...
Tue Aug 16 15:57:11 [initandlisten] shutdown: going to close sockets...
Tue Aug 16 15:57:11 [initandlisten] shutdown: waiting for fs preallocator...
Tue Aug 16 15:57:11 [initandlisten] shutdown: closing all files...
Tue Aug 16 15:57:11 closeAllFiles() finished
Tue Aug 16 15:57:11 [initandlisten] shutdown: removing fs lock...
Tue Aug 16 15:57:11 dbexit: really exiting now

任何帮助将不胜感激, 谢谢!

4 个答案:

答案 0 :(得分:4)

您需要/ data / db /

的读/写权限

答案 1 :(得分:1)

错误显示,因为您没有以root用户身份登录。要做到这一点(如果你使用Debian),运行:

sudo mongod 

或者简单地说:

su root

然后输入密码并输入

mongod

然后你就可以访问了  / data / db目录。

答案 2 :(得分:0)

我删除了/data/db/mongod.lock来解决问题。

答案 3 :(得分:0)

从命令行运行:

  1. cd~
  2. ./ mongod --repair
  3. 如果你仍然无法运行它,那么找到/ data目录(它应该在〜或〜/ workspace中)并cd进去。进入后,运行rm mongod.lock然后再回到〜并再次运行./mongod(见下文)。

    1. cd~ / data
    2. rm mongod.lock
    3. CD
    4. ./ mongod的