赵走x博客
网站访问量:151306
首页
书籍
软件
工具
古诗词
搜索
登录
Mac安装MongoDb
Centos7安装mongodump
Centos7安装mongodb4.0
Centos7安装mongodb7.0
Mac安装MongoDb
资源编号:389839
热度:144
Mac安装MongoDb
### 使用 brew 安装 此外你还可以使用 OSX 的 brew 来安装 mongodb: ``` brew tap mongodb/brew brew install mongodb-community@4.4 ``` @ 符号后面的 4.4 是最新版本号。 安装信息: ``` 配置文件:/usr/local/etc/mongod.conf 日志文件路径:/usr/local/var/log/mongodb 数据存放路径:/usr/local/var/mongodb ``` ### 运行 MongoDB 我们可以使用 brew 命令或 mongod 命令来启动服务。 brew 启动: ``` brew services start mongodb-community@4.4 brew 停止: brew services stop mongodb-community@4.4 ``` mongod 命令后台进程方式: ``` mongod --config /usr/local/etc/mongod.conf --fork ``` 这种方式启动要关闭可以进入 mongo shell 控制台来实现: ``` > db.adminCommand({ "shutdown" : 1 }) ``` # 安装日志 ``` mongodb-community@4.4 is keg-only, which means it was not symlinked into /usr/local, because this is an alternate version of another formula. If you need to have mongodb-community@4.4 first in your PATH, run: echo 'export PATH="/usr/local/opt/mongodb-community@4.4/bin:$PATH"' >> ~/.zshrc To have launchd start mongodb/brew/mongodb-community@4.4 now and restart at login: brew services start mongodb/brew/mongodb-community@4.4 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.4/4.4.8: 11 files, 156.6MB, built in 5 seconds ==> Caveats ==> mongodb-community@4.4 mongodb-community@4.4 is keg-only, which means it was not symlinked into /usr/local, because this is an alternate version of another formula. If you need to have mongodb-community@4.4 first in your PATH, run: echo 'export PATH="/usr/local/opt/mongodb-community@4.4/bin:$PATH"' >> ~/.zshrc To have launchd start mongodb/brew/mongodb-community@4.4 now and restart at login: brew services start mongodb/brew/mongodb-community@4.4 Or, if you don't want/need a background service you can just run: mongod --config /usr/local/etc/mongod.conf (base) mark@bogon ~ % brew services start mongodb/brew/mongodb-community@4.4 ==> Successfully started `mongodb-community@4.4` (label: homebrew.mxcl.mongodb-community@4.4) ```