【问题标题】:Cannot start MongoDB无法启动 MongoDB
【发布时间】:2016-10-22 01:40:43
【问题描述】:

这是我第 5 次安装 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

【问题讨论】:

    标签: node.js mongodb homebrew


    【解决方案1】:

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

    编辑

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

    【讨论】:

    • 谢谢,但这似乎仍然不起作用。
    【解决方案2】:

    好吧,我终于想通了。这两个修复的一些组合做到了:

    【讨论】:

      猜你喜欢
      • 2011-05-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-08
      相关资源
      最近更新 更多