当我运行 MongoDB 时,我通常手动启动它(即它不是我的登录启动项的一部分),并且我擅长在关闭之前停止该服务。
我最近重新启动了笔记本电脑,并在运行时收到错误:
brew services run mongodb/brew/mongodb-community
Run Code Online (Sandbox Code Playgroud)
错误消息如下:
错误:#<Formula mongodb-community (stable) /usr/local/Homebrew/Library/Taps/mongodb/homebrew-brew/Formula/mongodb-community.rb> 的未定义方法“plist_startup”
我不太确定发生了什么事。我尚未安装任何重大更新或对我的环境进行任何修改。
我完全卸载了 MongoDB,然后再次安装:
# Uninstall each component of mongodb-community...
brew uninstall mongodb/brew/mongodb-community
brew uninstall mongodb/brew/mongodb-database-tools
brew uninstall mongosh
# Reinstall all of the above...
brew install mongodb/brew/mongodb-community
Run Code Online (Sandbox Code Playgroud)
mongod --version
db version v7.0.2
Build Info: {
"version": "7.0.2",
"gitVersion": "02b3c655e1302209ef046da6ba3ef6749dd0b62a",
"modules": [],
"allocator": "system",
"environment": {
"distarch": "x86_64",
"target_arch": "x86_64"
}
}
Run Code Online (Sandbox Code Playgroud)
老实说,有时在深夜,我会处于自动驾驶状态。brew upgrade我可能在某个时候运行过,也可能没有运行过。我会调查一下是否发生过这种情况。与此同时,当我在 Homebrew 中获取 MongoDB 的日志时,我什至没有看到会对我产生影响的提交:
brew log mongodb/brew/mongodb-community
# …Run Code Online (Sandbox Code Playgroud)