如果在MongoDB启动时出现SocketException的情况,应对方法有哪些?

引入MongoDB!但是…

遵循MacOS版本的安装指南进行操作,但是… (Simplified Chinese)
按照MacOS版本的安裝指南來進行,但是… (Traditional Chinese)

2020-02-22T06:19:45.373+0900 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:341:17
@(connect):2:6
2020-02-22T06:19:45.375+0900 F  -        [main] exception: connect failed
2020-02-22T06:19:45.375+0900 E  -        [main] exiting with code 1

出现了错误。在进行了多个搜索之后,
在这篇文章中找到了解决方法。

$ rm /tmp/mongodb-27017.sock
$ brew services restart mongodb-community
Stopping `mongodb-community`... (might take a while)
==> Successfully stopped `mongodb-community` (label: homebrew.mxcl.mongodb-community)
$ mongo
MongoDB shell version v4.2.3
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
MongoDB server version: 4.2.3
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
    http://docs.mongodb.org/
Questions? Try the support group
    http://groups.google.com/group/mongodb-user

>

开动了!

相关的文章

    • インストールガイド(MongoDB公式)

How to solve the “Failed to unlink socket file” error in MongoDB

广告
将在 10 秒后关闭
bannerAds