安裝
MacBook-Air:Downloads huangyong$ brew install mongodb
部分提示信息
==> Caveats
To have launchd start mongodb now and restart at login:
brew services start mongodb
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/3.4.4: 18 files, 266.3MB
啟動服務
MacBook-Air:Downloads huangyong$ brew services start mongodb
==> Successfully started `mongodb` (label: homebrew.mxcl.mongodb)
進入
MacBook-Air:Downloads huangyong$ mongo
MongoDB shell version v3.4.4
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.4
Server has startup warnings:
2017-06-28T18:22:18.145+0800 I CONTROL? [initandlisten]
2017-06-28T18:22:18.145+0800 I CONTROL? [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-06-28T18:22:18.145+0800 I CONTROL? [initandlisten] **? ? ? ? ? Read and write access to data and configuration is unrestricted.
2017-06-28T18:22:18.145+0800 I CONTROL? [initandlisten]
?關閉服務
MacBook-Air:Downloads huangyong$ brew services stop mongodb
Stopping `mongodb`... (might take a while)
==> Successfully stopped `mongodb` (label: homebrew.mxcl.mongodb)
mongoldb和redis有很多類事之處
redis特別小,有機會可以優(yōu)先考慮用redis