今天在使用brew install mongodb 安裝 mongodb 時(shí)钧嘶,報(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)行:
啟動(dòng)mongodb-community服務(wù)器:$ brew services start mongodb-community
關(guān)閉mongodb-community服務(wù)器:$ brew services stop mongodb-community
mongod手動(dòng)開(kāi)始:
如果您不需要或不需要后臺(tái)MongoDB服務(wù)棠众,則可以運(yùn)行:
$ mongod --config /usr/local/etc/mongod.conf
注意:如果您未在--config配置文件路徑中包含該選項(xiàng),則MongoDB服務(wù)器將沒(méi)有默認(rèn)配置文件或日志目錄路徑有决,而將使用的數(shù)據(jù)目錄路徑/data/db闸拿。
要mongod手動(dòng)啟動(dòng)關(guān)機(jī),請(qǐng)使用admin數(shù)據(jù)庫(kù)并運(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