Homebrew启动mongodb-community@5.0失败:Bootstrap报I/O错误
MongoDB Community 5.0启动失败(Bootstrap failed: 5: Input/output error)排查与解决
我通过Homebrew安装了mongodb-community@5.0,执行mongod --version可正常返回对应版本信息,但执行brew services start mongodb-community@5.0时触发错误:
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing;/bin/launchctl bootstrap gui/502 /Users/<user>/Library/LaunchAgents/homebrew.mxcl.mongodb-community@5.0.plistexited with 5.
配置详情
.zshrc 文件内容
export PATH=/opt/homebrew/bin:$PATH export PATH="/opt/homebrew/opt/mongodb-community@5.0/bin:$PATH" export PATH="/opt/homebrew/opt/mongodb-community@5.0/bin:$PATH"
mongod.conf 文件配置(位于/opt/homebrew/etc/mongod.conf,M1芯片)
destination: file path: /opt/homebrew/var/log/mongodb/mongo.log logAppend: true storage: dbPath: /opt/homebrew/var/mongodb net: bindIp: 127.0.0.1, ::1 ipv6: true
解决步骤
检查目录权限
日志和数据目录权限异常是触发I/O错误的常见原因,执行以下命令修复:sudo chown -R $(whoami) /opt/homebrew/var/log/mongodb sudo chown -R $(whoami) /opt/homebrew/var/mongodb重建LaunchAgent配置文件
删除损坏的plist文件后重新生成:rm /Users/<user>/Library/LaunchAgents/homebrew.mxcl.mongodb-community@5.0.plist brew services restart mongodb-community@5.0注意将命令中的
<user>替换为你的实际系统用户名。手动启动验证配置
先跳过brew services,手动启动mongod确认配置有效性:mongod --config /opt/homebrew/etc/mongod.conf如果手动启动成功,说明是brew的服务配置问题,重新执行
brew services start mongodb-community@5.0即可。简化PATH配置
.zshrc中重复添加了MongoDB的PATH项,可简化为以下内容,再执行source ~/.zshrc生效:export PATH=/opt/homebrew/bin:$PATH export PATH="/opt/homebrew/opt/mongodb-community@5.0/bin:$PATH"
内容的提问来源于stack exchange,提问作者Aman
相关产品推荐
相关产品推荐

