我已经安装了 Homebrew 多年。几周前,我通过 Homebrew 安装了 MongoDB Community。我能够启动 MongoDB 并通过
mongosh
连接到它。
我重新启动计算机,MongoDB 无法重新启动。虽然,启动时它会说它已开始。
brew services restart mongodb-community
Stopping `mongodb-community`... (might take a while)
==> Successfully stopped `mongodb-community` (label: homebrew.mxcl.mongodb-community)
==> Successfully ran `mongodb-community` (label: homebrew.mxcl.mongodb-community)
但事实是
Name Status User File
mongodb-community error 512 /usr/local/opt/mongodb-community/homebrew.mxcl.mongodb-community.plist
我在
/tmp/
中检查了锁定文件。没有看到任何与 MongoDB 有关的文件。
我卸载并删除了所有 Homebrew 和 Mongodb。然后再次安装,还是出现同样的错误。
有人解决这个问题了吗?
任何帮助将不胜感激。
编辑1: 这是来自
/usr/local/var/log/mongodb/output.log
的日志
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
{"t":{"$date":"2024-03-04T08:29:19.900Z"},"s":"W", "c":"CONTROL", "id":23320, "ctx":"thread1","msg":"Option: Given key is deprecated. Please use preferred key instead.","attr":{"deprecatedKey":"net.ssl.PEMKeyFile","preferredKey":"net.tls.certificateKeyFile"}}
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
{"t":{"$date":"2024-03-04T16:57:06.256Z"},"s":"W", "c":"CONTROL", "id":23320, "ctx":"thread1","msg":"Option: Given key is deprecated. Please use preferred key instead.","attr":{"deprecatedKey":"net.ssl.PEMKeyFile","preferredKey":"net.tls.certificateKeyFile"}}
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
{"t":{"$date":"2024-03-04T17:16:32.791Z"},"s":"W", "c":"CONTROL", "id":23320, "ctx":"thread1","msg":"Option: Given key is deprecated. Please use preferred key instead.","attr":{"deprecatedKey":"net.ssl.PEMKeyFile","preferredKey":"net.tls.certificateKeyFile"}}
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
{"t":{"$date":"2024-03-04T17:17:23.014Z"},"s":"W", "c":"CONTROL", "id":23320, "ctx":"thread1","msg":"Option: Given key is deprecated. Please use preferred key instead.","attr":{"deprecatedKey":"net.ssl.PEMKeyFile","preferredKey":"net.tls.certificateKeyFile"}}
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
{"t":{"$date":"2024-03-04T19:00:00.733Z"},"s":"W", "c":"CONTROL", "id":23320, "ctx":"thread1","msg":"Option: Given key is deprecated. Please use preferred key instead.","attr":{"deprecatedKey":"net.ssl.PEMKeyFile","preferredKey":"net.tls.certificateKeyFile"}}
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
{"t":{"$date":"2024-03-04T19:08:23.290Z"},"s":"W", "c":"CONTROL", "id":23320, "ctx":"thread1","msg":"Option: Given key is deprecated. Please use preferred key instead.","attr":{"deprecatedKey":"net.ssl.PEMKeyFile","preferredKey":"net.tls.certificateKeyFile"}}
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
{"t":{"$date":"2024-03-04T19:12:50.509Z"},"s":"W", "c":"CONTROL", "id":23320, "ctx":"thread1","msg":"Option: Given key is deprecated. Please use preferred key instead.","attr":{"deprecatedKey":"net.ssl.PEMKeyFile","preferredKey":"net.tls.certificateKeyFile"}}
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
{"t":{"$date":"2024-03-04T19:15:29.945Z"},"s":"W", "c":"CONTROL", "id":23320, "ctx":"thread1","msg":"Option: Given key is deprecated. Please use preferred key instead.","attr":{"deprecatedKey":"net.ssl.PEMKeyFile","preferredKey":"net.tls.certificateKeyFile"}}
Unrecognized option: net.ssl.PEMCertificateFile
try '/usr/local/opt/mongodb-community/bin/mongod --help' for more information
编辑2:解决方案:感谢评论中的@Joe。 这是我的conf文件:
/usr/local/etc/mongod.conf
systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
dbPath: /usr/local/var/mongodb
net:
bindIp: 127.0.0.1, ::1
ipv6: true
port: 27017
ssl:
mode: requireSSL
PEMKeyFile: /usr/local/etc/ssl/mongodb-cert.key
PEMCertificateFile: /usr/local/etc/ssl/mongodb-cert.crt
与 mongodb.com/docs/manual/reference/configuration-options 进行比较;缺少的属性是 PEMCertificateFile。显然这不再是受支持的属性。为了更好地衡量,我注释掉了
ssl
属性及其子属性。
一切顺利。
在帖子评论中向@Joe 大声喊叫。
以下是通过自制程序全新安装 mongodb 时附带的
/usr/local/etc/mongod.conf
。
systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
dbPath: /usr/local/var/mongodb
net:
bindIp: 127.0.0.1, ::1
ipv6: true
port: 27017
ssl:
mode: requireSSL
PEMKeyFile: /usr/local/etc/ssl/mongodb-cert.key
PEMCertificateFile: /usr/local/etc/ssl/mongodb-cert.crt
与 mongodb.com/docs/manual/reference/configuration-options 进行比较;缺少的有问题的属性是 PEMCertificateFile。显然这不再是受支持的属性。为了更好地衡量,我注释掉了
ssl
属性及其子属性。
一切顺利。
所以我的
/usr/local/etc/mongod.conf
看起来不像
systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
dbPath: /usr/local/var/mongodb
net:
bindIp: 127.0.0.1, ::1
ipv6: true
port: 27017
# ssl:
# mode: requireSSL
# PEMKeyFile: /usr/local/etc/ssl/mongodb-cert.key
# PEMCertificateFile: /usr/local/etc/ssl/mongodb-cert.crt