使用 Homebrew 安装 MongoDB
Installing MongoDB with Homebrew
我是 MongoDB 的新手,正在尝试使用 Homebrew 在我的 Mac 上安装 MongoDB,但出现以下错误:
Error: No available formula with the name "mongodb"
==> Searching for a previously deleted formula (in the last
month)...
Warning: homebrew/core is shallow clone. To get complete history
run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
我运行
brew update
然后
brew install mongodb
公式 mongodb
已从 homebrew-core 中删除。从 homebrew-core
检查 pr-43770
To our users: if you came here because mongodb stopped working for you, we have removed it from the Homebrew core formulas since it was migrated to a non open-source license.
幸运的是,mongodb 的团队正在维护一个自定义的 Homebrew 水龙头。您可以卸载旧的 mongodb 并从新的水龙头重新安装新的。
# If you still have the old mongodb installed from homebrew-core
brew services stop mongodb
brew uninstall homebrew/core/mongodb
# Use the migrated distribution from custom tap
brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-community
查看 mongodb/homebrew-brew 了解更多信息。
在您的终端中尝试此代码:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
然后:
brew tap mongodb/brew
最后:
brew install mongodb-community@4.0
首次安装mongodb
brew tap mongodb/brew
其次使用此命令安装。 mangodb 安装成功
brew install mongodb-community@4.0
你会得到输出
==> CaveatsTo have launchd start mongodb/brew/mongodb-community now and restart at login:
brew services start mongodb/brew/mongodb-community
Or, if you don't want/need a background service you can just run:
mongod --config /usr/local/etc/mongod.conf
==> Summary
/usr/local/Cellar/mongodb-community/4.2.2: 21 files, 274.5MB, built in 2 minutes 46 seconds
brew services start mongodb/brew/mongodb-community
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-commu
在 MacOs Catalina 中我无法正常工作。
安装后 (https://zellwk.com/blog/install-mongodb/) 我必须向“/tmp/mongodb-27017.sock”添加权限
sudo chown -R `id -un` /tmp/mongodb-27017.sock
命令“mongod”似乎忽略了“/usr/local/etc”中的配置文件(mongod.conf),因此我必须始终使用 dbpath 参数启动它
mongod --dbpath /usr/local/var/mongodb
即使在配置文件中指定了相同的路径。
我也对配置文件使用“mongod”无效
mongod -f /usr/local/etc/mongod.conf
或
mongod --config /usr/local/etc/mongod.conf
我通过 brew 服务启动 mongodb 解决了所有这些问题。这运行良好,没有问题,并从正确的配置文件中获取参数。
brew services run mongodb-community
关于 macOS Big Sur
和 Homebrew
,mongodb 文档指出:https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
您应该安装支持 macOS 10.13 或更高版本的 4.4 Community Edition,因此这些步骤会有所帮助。
解决方案 1:
如果您之前安装了旧版本的公式,您可能会遇到 ChecksumMismatchError
来解决这个问题:
删除下载的 .tgz 存档。
brew untap mongodb/brew && brew tap mongodb/brew
重新点击公式。
brew install mongodb-community@4.4
解决方案 2:
如果您还没有安装任何版本的公式。
安装 Xcode 命令行工具和 Homebrew
xcode-select --install
2、点击MongoDB Homebrew Tap:
brew tap mongodb/brew
3、在 macOS 终端中验证安装先决条件:
brew tap | grep mongodb
4、安装MongoDB
brew install mongodb-community@4.4
注意:安装包括:
• mongod 服务器,
• mongos 分片集群查询路由器,
• mongo shell
参考这个截图:
最后将运行MongoDB(即mongod进程)作为macOS服务,执行如下命令:
brew services start mongodb-community@4.4
截图:
~ % brew services run mongodb-community
/usr/local/opt/mongodb-community/homebrew.mxcl.mongodb-community.plist: service already loaded
Error: Failure while executing
/bin/launchctl bootstrap gui/501 /usr/local/opt/mongodb-community/homebrew.mxcl.mongodb-community.plist
exited with 17.
我是 MongoDB 的新手,正在尝试使用 Homebrew 在我的 Mac 上安装 MongoDB,但出现以下错误:
Error: No available formula with the name "mongodb"
==> Searching for a previously deleted formula (in the last
month)...
Warning: homebrew/core is shallow clone. To get complete history
run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
我运行
brew update
然后
brew install mongodb
公式 mongodb
已从 homebrew-core 中删除。从 homebrew-core
To our users: if you came here because mongodb stopped working for you, we have removed it from the Homebrew core formulas since it was migrated to a non open-source license.
幸运的是,mongodb 的团队正在维护一个自定义的 Homebrew 水龙头。您可以卸载旧的 mongodb 并从新的水龙头重新安装新的。
# If you still have the old mongodb installed from homebrew-core
brew services stop mongodb
brew uninstall homebrew/core/mongodb
# Use the migrated distribution from custom tap
brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-community
查看 mongodb/homebrew-brew 了解更多信息。
在您的终端中尝试此代码:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
然后:
brew tap mongodb/brew
最后:
brew install mongodb-community@4.0
首次安装mongodb
brew tap mongodb/brew
其次使用此命令安装。 mangodb 安装成功
brew install mongodb-community@4.0
你会得到输出
==> CaveatsTo have launchd start mongodb/brew/mongodb-community now and restart at login:
brew services start mongodb/brew/mongodb-community
Or, if you don't want/need a background service you can just run:
mongod --config /usr/local/etc/mongod.conf
==> Summary
/usr/local/Cellar/mongodb-community/4.2.2: 21 files, 274.5MB, built in 2 minutes 46 seconds
brew services start mongodb/brew/mongodb-community
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-commu
在 MacOs Catalina 中我无法正常工作。
安装后 (https://zellwk.com/blog/install-mongodb/) 我必须向“/tmp/mongodb-27017.sock”添加权限
sudo chown -R `id -un` /tmp/mongodb-27017.sock
命令“mongod”似乎忽略了“/usr/local/etc”中的配置文件(mongod.conf),因此我必须始终使用 dbpath 参数启动它
mongod --dbpath /usr/local/var/mongodb
即使在配置文件中指定了相同的路径。
我也对配置文件使用“mongod”无效
mongod -f /usr/local/etc/mongod.conf
或
mongod --config /usr/local/etc/mongod.conf
我通过 brew 服务启动 mongodb 解决了所有这些问题。这运行良好,没有问题,并从正确的配置文件中获取参数。
brew services run mongodb-community
关于 macOS Big Sur
和 Homebrew
,mongodb 文档指出:https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
您应该安装支持 macOS 10.13 或更高版本的 4.4 Community Edition,因此这些步骤会有所帮助。
解决方案 1:
如果您之前安装了旧版本的公式,您可能会遇到 ChecksumMismatchError
来解决这个问题:
删除下载的 .tgz 存档。
brew untap mongodb/brew && brew tap mongodb/brew
重新点击公式。
brew install mongodb-community@4.4
解决方案 2: 如果您还没有安装任何版本的公式。
安装 Xcode 命令行工具和 Homebrewxcode-select --install
2、点击MongoDB Homebrew Tap:
brew tap mongodb/brew
3、在 macOS 终端中验证安装先决条件:
brew tap | grep mongodb
4、安装MongoDB
brew install mongodb-community@4.4
注意:安装包括:
• mongod 服务器,
• mongos 分片集群查询路由器,
• mongo shell
参考这个截图:
最后将运行MongoDB(即mongod进程)作为macOS服务,执行如下命令:
brew services start mongodb-community@4.4
截图:
~ % brew services run mongodb-community
/usr/local/opt/mongodb-community/homebrew.mxcl.mongodb-community.plist: service already loaded
Error: Failure while executing
/bin/launchctl bootstrap gui/501 /usr/local/opt/mongodb-community/homebrew.mxcl.mongodb-community.plist
exited with 17.