无法连接MongoDB

时间:2018-06-28 15:27:57

标签: mongodb

我在与mongo连接时遇到问题。

me@the_host:~$ mongo

MongoDB shell version v4.0.0
connecting to: mongodb://127.0.0.1:27017
2018-06-28T17:06:37.445+0200 E QUERY    [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed

我去/var/log/mongodb/mongod.log看:

2018-06-28T17:16:11.763+0200 I COMMAND  [initandlisten] Assigning UUID b237b94b-b3a3-4ba1-9c39-c87d6f3555db to collection local.startup_log
2018-06-28T17:16:11.764+0200 F STORAGE  [initandlisten] Unable to start up mongod due to missing featureCompatibilityVersion document.
2018-06-28T17:16:11.764+0200 F STORAGE  [initandlisten] Please run with --journalOptions 4 to recover the journal. Then run with --repair to restore the document.
2018-06-28T17:16:11.764+0200 F -        [initandlisten] Fatal Assertion 40652 at src/mongo/db/repair_database_and_check_version.cpp 555
2018-06-28T17:16:11.764+0200 F -        [initandlisten]

我先执行mongod --journalOptions 4,然后执行mongod --repair,但错误仍然相同。 我不知道下一步该怎么办。

有人可以克服我的困难吗?

0 个答案:

没有答案