无法启动MongoDB

时间:2016-10-22 01:40:43

标签: node.js mongodb homebrew

这是我第五次安装MongoDB,它只是第一次连接或间歇性连接。我第五次尝试使用Homebrew。

以下是我遇到的两个不同错误:

2016-10-18T01:19:21.746-0700 I CONTROL  [initandlisten] MongoDB starting : pid=40879 port=27017 dbpath=/data/db 64-bit host=CA17PCG8WP
2016-10-18T01:19:21.746-0700 I CONTROL  [initandlisten] db version v3.2.10
2016-10-18T01:19:21.746-0700 I CONTROL  [initandlisten] git version: 79d9b3ab5ce20f51c272b4411202710a082d0317
2016-10-18T01:19:21.746-0700 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 0.9.8zg 14 July 2015
2016-10-18T01:19:21.746-0700 I CONTROL  [initandlisten] allocator: system
2016-10-18T01:19:21.746-0700 I CONTROL  [initandlisten] modules: none
2016-10-18T01:19:21.746-0700 I CONTROL  [initandlisten] build environment:
2016-10-18T01:19:21.746-0700 I CONTROL  [initandlisten]     distarch: x86_64
2016-10-18T01:19:21.746-0700 I CONTROL  [initandlisten]     target_arch: x86_64
2016-10-18T01:19:21.746-0700 I CONTROL  [initandlisten] options: {}
2016-10-18T01:19:21.747-0700 I -        [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-10-18T01:19:21.747-0700 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=9G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2016-10-18T01:19:22.124-0700 I CONTROL  [initandlisten] 
2016-10-18T01:19:22.124-0700 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2016-10-18T01:19:22.125-0700 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2016-10-18T01:19:22.125-0700 I NETWORK  [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-10-18T01:19:22.125-0700 I NETWORK  [initandlisten] waiting for connections on port 27017
2016-10-18T01:19:22.126-0700 W NETWORK  [HostnameCanonicalizationWorker] Failed to obtain address information for hostname CA17PCG8WP: nodename nor servname provided, or not known

2016-10-21T18:31:30.436-0700 I CONTROL  [initandlisten] MongoDB starting : pid=2982 port=27017 dbpath=/data/db 64-bit host=CA17PCG8WP
2016-10-21T18:31:30.437-0700 I CONTROL  [initandlisten] db version v3.2.10
2016-10-21T18:31:30.437-0700 I CONTROL  [initandlisten] git version: 79d9b3ab5ce20f51c272b4411202710a082d0317
2016-10-21T18:31:30.437-0700 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 0.9.8zg 14 July 2015
2016-10-21T18:31:30.437-0700 I CONTROL  [initandlisten] allocator: system
2016-10-21T18:31:30.437-0700 I CONTROL  [initandlisten] modules: none
2016-10-21T18:31:30.437-0700 I CONTROL  [initandlisten] build environment:
2016-10-21T18:31:30.437-0700 I CONTROL  [initandlisten]     distarch: x86_64
2016-10-21T18:31:30.437-0700 I CONTROL  [initandlisten]     target_arch: x86_64
2016-10-21T18:31:30.437-0700 I CONTROL  [initandlisten] options: {}
2016-10-21T18:31:30.437-0700 I -        [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-10-21T18:31:30.437-0700 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=9G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2016-10-21T18:31:30.439-0700 E STORAGE  [initandlisten] WiredTiger (13) [1477099890:439019][2982:0x7fff73c85300], file:WiredTiger.wt, connection: /data/db/WiredTiger.turtle: handle-open: open: Permission denied
2016-10-21T18:31:30.446-0700 I -        [initandlisten] Assertion: 28595:13: Permission denied
2016-10-21T18:31:30.447-0700 I STORAGE  [initandlisten] exception in initAndListen: 28595 13: Permission denied, terminating
2016-10-21T18:31:30.447-0700 I CONTROL  [initandlisten] dbexit:  rc: 100

有人可以请a)告诉我我做错了什么或b)告诉我如何卸载MongoDB然后正确安装?

修改

我相信我已经读过&写访问/ data / db /,但我还是使用了chmod。这是我可以访问的证明(对吗?):

whoami
this_user
ls -ld /data/
drwxr-xr-x  3 this_user  wheel  102 Oct 21 18:18 /data/
ls -ld /data/db/
drwxr-xr-x  16 this_user  wheel  544 Oct 21 18:31 /data/db/

这是我仍然得到的错误:

mongod
2016-10-22T12:10:26.301-0700 I CONTROL  [initandlisten] MongoDB starting : pid=5912 port=27017 dbpath=/data/db 64-bit host=CA17PCG8WP
2016-10-22T12:10:26.301-0700 I CONTROL  [initandlisten] db version v3.2.10
2016-10-22T12:10:26.301-0700 I CONTROL  [initandlisten] git version: 79d9b3ab5ce20f51c272b4411202710a082d0317
2016-10-22T12:10:26.302-0700 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 0.9.8zg 14 July 2015
2016-10-22T12:10:26.302-0700 I CONTROL  [initandlisten] allocator: system
2016-10-22T12:10:26.302-0700 I CONTROL  [initandlisten] modules: none
2016-10-22T12:10:26.302-0700 I CONTROL  [initandlisten] build environment:
2016-10-22T12:10:26.302-0700 I CONTROL  [initandlisten]     distarch: x86_64
2016-10-22T12:10:26.302-0700 I CONTROL  [initandlisten]     target_arch: x86_64
2016-10-22T12:10:26.302-0700 I CONTROL  [initandlisten] options: {}
2016-10-22T12:10:26.302-0700 I -        [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-10-22T12:10:26.302-0700 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=9G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2016-10-22T12:10:26.304-0700 E STORAGE  [initandlisten] WiredTiger (13) [1477163426:304329][5912:0x7fff73c85300], file:WiredTiger.wt, connection: /data/db/WiredTiger.turtle: handle-open: open: Permission denied
2016-10-22T12:10:26.311-0700 I -        [initandlisten] Assertion: 28595:13: Permission denied
2016-10-22T12:10:26.311-0700 I STORAGE  [initandlisten] exception in initAndListen: 28595 13: Permission denied, terminating
2016-10-22T12:10:26.311-0700 I CONTROL  [initandlisten] dbexit:  rc: 100

2 个答案:

答案 0 :(得分:0)

它会给你一个被拒绝的权限'数据目录上的错误。确保您在那里获得了正确的权限。要chown当前用户/组的目录(和父级),要么使用chmod调整权限,以确保您具有对/ data / db的读写权限。

编辑

我忘记了在某些系统上,mongodb以用户mongodb运行。检查/etc/passwd以查看是否有mongodb用户,如果是,请确保 用户或组具有写入权限。

答案 1 :(得分:0)

好的,我终于明白了。这两个修复程序的某些组合就是这样做的: