Mongo不会开始。得到神秘的断言:28595:13:权限被拒绝错误

时间:2017-06-01 21:04:51

标签: mongodb ubuntu-16.04

我试图启动计算机的mongodb服务但它无法启动。我花了一个多小时试图调试它,在那段时间我尝试了很多解决方案。尝试所有这些可能搞砸了我的mongo安装,但我尝试重新安装mongo以获得一个新的开始。那也行不通。我现在有以下错误,在谷歌上找不到任何关于如何修复它的内容。

2017-06-01T16:57:02.339-0400 I CONTROL  [main] ***** SERVER RESTARTED *****
2017-06-01T16:57:02.343-0400 I CONTROL  [initandlisten] MongoDB starting : pid=15070 port=27017 dbpath=/var/lib/mongodb 64-bit host=moss-greenelab
2017-06-01T16:57:02.343-0400 I CONTROL  [initandlisten] db version v3.2.13
2017-06-01T16:57:02.343-0400 I CONTROL  [initandlisten] git version: 23899209cad60aaafe114f6aea6cb83025ff51bc
2017-06-01T16:57:02.343-0400 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2017-06-01T16:57:02.343-0400 I CONTROL  [initandlisten] allocator: tcmalloc
2017-06-01T16:57:02.343-0400 I CONTROL  [initandlisten] modules: none
2017-06-01T16:57:02.343-0400 I CONTROL  [initandlisten] build environment:
2017-06-01T16:57:02.343-0400 I CONTROL  [initandlisten]     distmod: ubuntu1604
2017-06-01T16:57:02.343-0400 I CONTROL  [initandlisten]     distarch: x86_64
2017-06-01T16:57:02.343-0400 I CONTROL  [initandlisten]     target_arch: x86_64
2017-06-01T16:57:02.343-0400 I CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log", quiet: true } }
2017-06-01T16:57:02.361-0400 I -        [initandlisten] Detected data files in /var/lib/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2017-06-01T16:57:02.361-0400 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=18G,session_max=20000,eviction=(threads_min=4,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),
2017-06-01T16:57:02.364-0400 E STORAGE  [initandlisten] WiredTiger (13) [1496350622:364565][15070:0x7f80e0292c80], connection: /var/lib/mongodb/journal/WiredTigerPreplog.0000000002: file-remove: unlink: Permission denied
2017-06-01T16:57:02.383-0400 I -        [initandlisten] Assertion: 28595:13: Permission denied
2017-06-01T16:57:02.383-0400 I STORAGE  [initandlisten] exception in initAndListen: 28595 13: Permission denied, terminating
2017-06-01T16:57:02.383-0400 I CONTROL  [initandlisten] dbexit:  rc: 100

我正在运行Ubuntu 16.04。

1 个答案:

答案 0 :(得分:0)

这是日志的有说服力的部分:

/var/lib/mongodb/journal/WiredTigerPreplog.0000000002: file-remove: unlink: Permission denied

所以看看ls -la /var/lib/mongodb/journal,看看这些文件的权限是什么。我敢打赌那些(可能是其他人)没有被正确的用户正确拥有,在Ubuntu上通常是mongodb

假设您在那里遇到了所有权问题,您可以运行chown -R mongodb:mongodb /var/lib/mongodb

如果这不起作用,作为最后的手段,您可以随时通过运行rm -rf /var/lib/mongodb/*来清除数据目录(假设您不需要数据!)。