我是Ubuntu(Linux tbh)的新手。我遇到了启动MongoDB服务的问题。我想使用Ruby on Rails和MongoDB创建Web应用程序,但mongo似乎无法启动。
我跟着这个MongoDB installation on Ubuntu所有安装都没有问题,直到我到sudo service mongod start
mongod.log
2016-01-01T10:58:15.545+0000 I CONTROL ***** SERVER RESTARTED *****
2016-01-01T10:58:15.548+0000 I CONTROL [initandlisten] MongoDB starting : pid=3868 port=27017 dbpath=/var/lib/mongodb 64-bit host=damian-CX61-0NC-CX61-0ND-CX61-0NF-CX61-0NE
2016-01-01T10:58:15.548+0000 I CONTROL [initandlisten] db version v3.0.8
2016-01-01T10:58:15.548+0000 I CONTROL [initandlisten] git version: 83d8cc25e00e42856924d84e220fbe4a839e605d
2016-01-01T10:58:15.548+0000 I CONTROL [initandlisten] build info: Linux ip-10-187-89-126 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2016-01-01T10:58:15.548+0000 I CONTROL [initandlisten] allocator: tcmalloc
2016-01-01T10:58:15.548+0000 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" } }
2016-01-01T10:58:15.567+0000 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted
2016-01-01T10:58:15.567+0000 I - [initandlisten] Fatal Assertion 28578
2016-01-01T10:58:15.567+0000 I - [initandlisten]
***aborting after fassert() failure
那么我做错了什么或它的不同问题呢?
答案 0 :(得分:33)
文件/tmp/mongodb-27017.sock存在吗?如果是这样,试着删除它,即。 ' sudo rm /tmp/mongodb-27017.sock'。
答案 1 :(得分:3)
The problem can also be due to mongodb using up all the memory. That was the case for me. You can install ncdu with this command: sudo apt install ncdu
This will help you in looking at the memory usage. Use the command: ncdu -x /
Remove the unwanted dbs from /var/lib/mongodb/
答案 2 :(得分:1)
对我来说,这是因为文件夹“ / data / db”中的数据不正确
对我有用的解决方案:删除“ / data / db”中的所有文件
答案 3 :(得分:0)
在您的PC上重新安装mongodb服务器是最佳选择。重新安装后,以前使用/保存的所有数据库都会保留下来。
答案 4 :(得分:0)
如果您使用Ubuntu,请尝试:
sudo mongod
答案 5 :(得分:0)
sudo mongod
(由@JoãoBortolosso建议)
之后(@fresz建议):
sudo rm /tmp/mongodb-27017.sock
在Mac上工作!
答案 6 :(得分:0)
mongo --shell
它在ubuntu上对我有用