安装
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特别小,有机会可以优先考虑用redis