今天在使用brew install mongodb 安裝 mongodb 時,報(bào)Error: No available formula with the name 'mongodb'
經(jīng)原因查找如下:

圖一
設(shè)定:
$ brew tap mongodb/brew
安裝公式:
$ brew install mongodb-community
mongodb-community公式的默認(rèn)路徑:
配置文件: /usr/local/etc/mongod.conf
日志目錄路徑: /usr/local/var/log/mongodb
數(shù)據(jù)目錄路徑: /usr/local/var/mongodb
mongod作為服務(wù)運(yùn)行:
啟動mongodb-community服務(wù)器:$ brew services start mongodb-community
關(guān)閉mongodb-community服務(wù)器:$ brew services stop mongodb-community
mongod手動開始:
如果您不需要或不需要后臺MongoDB服務(wù),則可以運(yùn)行:
$ mongod --config /usr/local/etc/mongod.conf
注意:如果您未在--config配置文件路徑中包含該選項(xiàng),則MongoDB服務(wù)器將沒有默認(rèn)配置文件或日志目錄路徑,而將使用的數(shù)據(jù)目錄路徑/data/db。
要mongod手動啟動關(guān)機(jī),請使用admin數(shù)據(jù)庫并運(yùn)行db.shutdownServer():
$ mongo admin --eval "db.shutdownServer()"
參考鏈接:https://segmentfault.com/a/1190000020400235?utm_source=tag-newest
git鏈接:https://github.com/mongodb/homebrew-brew