已经有root数据/ db,但仍无法在Mac OS X上运行MongoDB

时间:2014-07-28 11:27:27

标签: macos mongodb

正如标题所说,我在Mac OS X上的根目录中有文件夹数据,在文件夹db里面。我用自制软件安装了mongodb,除此之外一切似乎都有效。我也拥有这两个文件夹的所有权限。当我运行命令" mongod"这是输出:

 mongod --help for help and startup options  
 2014-07-28T12:59:39.641+0200 [initandlisten] MongoDB starting : pid=16414 port=27017      dbpath=/data/db 64-bit host=Djangos-MacBook-Air.local  
 2014-07-28T12:59:39.642+0200 [initandlisten]   
 2014-07-28T12:59:39.642+0200 [initandlisten] ** WARNING: soft rlimits too low. Number of    files is 256, should be at least 1000  
 2014-07-28T12:59:39.642+0200 [initandlisten] db version v2.6.3  
 2014-07-28T12:59:39.642+0200 [initandlisten] git version: nogitversion  
 2014-07-28T12:59:39.642+0200 [initandlisten] build info: Darwin minimavericks.local      13.2.0 Darwin Kernel Version 13.2.0: Thu Apr 17 23:03:13 PDT 2014; root:xnu-    2422.100.13~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49  
 2014-07-28T12:59:39.642+0200 [initandlisten] allocator: tcmalloc  
 2014-07-28T12:59:39.642+0200 [initandlisten] options: {}  
 2014-07-28T12:59:39.642+0200 [initandlisten] exception in initAndListen: 10310 Unable    to lock file: /data/db/mongod.lock. Is a mongod instance already running?, terminating  
 2014-07-28T12:59:39.642+0200 [initandlisten] dbexit:   
 2014-07-28T12:59:39.642+0200 [initandlisten] shutdown: going to close listening  sockets...  
 2014-07-28T12:59:39.642+0200 [initandlisten] shutdown: going to flush diaglog...  
 2014-07-28T12:59:39.642+0200 [initandlisten] shutdown: going to close sockets...  
 2014-07-28T12:59:39.642+0200 [initandlisten] shutdown: waiting for fs preallocator...  
 2014-07-28T12:59:39.642+0200 [initandlisten] shutdown: lock for final commit...  
 2014-07-28T12:59:39.642+0200 [initandlisten] shutdown: final commit...  
 2014-07-28T12:59:39.642+0200 [initandlisten] shutdown: closing all files...  
 2014-07-28T12:59:39.643+0200 [initandlisten] closeAllFiles() finished  
 2014-07-28T12:59:39.643+0200 [initandlisten] dbexit: really exiting now`  

如果有人可以帮助我,我会很高兴,因为我已经用谷歌搜索了很多东西并且没有找到任何解决方案。

1 个答案:

答案 0 :(得分:0)

首先,我建议不要在Mac OS X的根目录下创建数据文件夹。如果这样做,那么你必须以root用户身份运行mongod。因此,最好在自己的主目录中创建数据文件夹,即/ Users / yourname /。

现在,让我告诉你这个问题。它说,'无法锁定文件:/data/db/mongod.lock'。这意味着它无法写入该位置。所以解决方案是 - 以root身份运行mongod或将数据文件夹的位置更改为您有权写入的自己的主页位置。