Mongo 升级到 Mac BIgSur 后启动问题 -(无法取消链接套接字文件)

Mongo start problems after upgrading to Mac BIgSur - (Failed to unlink socket file)

我已将我的 MacO 升级到 BigSur。从那时起我就无法启动我已经安装的 Mongo.

所以,我决定卸载我的 4.2 Mongo 版本并转到 4.4 版本:

$ brew uninstall mongodb
$ brew install mongodb-community@4.4

没问题。

当 运行 我必须升级到 XCode 12(使用 AppStore 应用程序完成)。

没问题。

现在是时候开始了Mongo:

$ brew services start mongodb-community@4.4

我收到以下错误:

{"t":{"$date":"2021-04-30T10:53:39.834-03:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2021-04-30T10:53:39.837-03:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-04-30T10:53:39.837-03:00"},"s":"I",  "c":"NETWORK",  "id":4648602, "ctx":"main","msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2021-04-30T10:53:39.838-03:00"},"s":"I",  "c":"STORAGE",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":9309,"port":27017,"dbPath":"/usr/local/var/mongodb","architecture":"64-bit","host":"MBook1.local"}}
{"t":{"$date":"2021-04-30T10:53:39.838-03:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.5","gitVersion":"ff5cb77101b052fa02da43b8538093486cf9b3f7","modules":[],"allocator":"system","environment":{"distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2021-04-30T10:53:39.838-03:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Mac OS X","version":"20.4.0"}}}
{"t":{"$date":"2021-04-30T10:53:39.838-03:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/usr/local/etc/mongod.conf","net":{"bindIp":"127.0.0.1"},"storage":{"dbPath":"/usr/local/var/mongodb"},"systemLog":{"destination":"file","logAppend":true,"path":"/usr/local/var/log/mongodb/mongo.log"}}}}
{"t":{"$date":"2021-04-30T10:53:39.839-03:00"},"s":"E",  "c":"NETWORK",  "id":23024,   "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Permission denied"}}
{"t":{"$date":"2021-04-30T10:53:39.839-03:00"},"s":"F",  "c":"-",        "id":23091,   "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":919}}
{"t":{"$date":"2021-04-30T10:53:39.839-03:00"},"s":"F",  "c":"-",        "id":23092,   "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}

似乎问题出在“无法取消链接套接字文件”。我怀疑这与 BigSur 安全功能有关,但我找不到解决方法。试图查看系统偏好设置中的“安全偏好设置”,但我找不到 Mongo 个问题。

这是权限问题。

错误消息中指出的套接字文件归 root 所有,其他用户没有权限。日志中特意喊出了permission denied,说明brew启动服务的账号不是root。

"msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Permission denied"}

要解决此问题,请使用 sudo rm /tmp/mongodb-27017.sock 手动删除文件,然后尝试启动 mongod。