xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

MongoDB & macOS & brew All In One

MongoDB & macOS & brew All In One

MongoDB 4.2 Manual

https://docs.mongodb.com/manual/

install MongoDB

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/#install-mongodb-community-edition

1. CLI install

$ brew tap mongodb/brew

# MongoDB Community Edition
$ brew install mongodb-community@4.2

# /usr/local/etc/mongod.conf
# /usr/local/var/log/mongodb
# /usr/local/var/mongodb

$ brew services list

# server
$ brew services start mongodb-community@4.2

$ brew services stop mongodb-community@4.2

$ mongod --config /usr/local/etc/mongod.conf --fork


$ ps aux | grep -v grep | grep mongod

# client
$ mongo

In addition to the binaries, the install creates:

the configuration file (/usr/local/etc/mongod.conf)
the log directory path (/usr/local/var/log/mongodb)
the data directory path (/usr/local/var/mongodb)

https://github.com/mongodb/homebrew-brew

https://docs.mongodb.com/manual/reference/configuration-options/

$ brew untap mongodb/brew && brew tap mongodb/brew

$ brew install mongodb-community@4.2

2. zip 手动安装 4.2.x

https://www.mongodb.com/try/download/community

https://www.mongodb.com/dr/fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.8.tgz/download

跳过, 直接下载

https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.8.tgz

4.2.8

# download .tgz,  https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.8.tgz
$ cd Downloads 

# unzip
$ tar xzf mongodb-macos-x86_64-4.2.8.tgz

# move to  /usr/local/
$ sudo mv mongodb-macos-x86_64-4.2.8 /usr/local/mongodb 

$ sudo mkdir /data/db
# mkdir: /data: No such file or directory
$ sudo mkdir -p /data/db
mkdir: /data/db: Read-only file system

# macOS 14.x -
$ sudo mkdir -p /data/db

# macOS 15.x +
$ sudo mkdir -p /System/Volumes/Data/data/db

https://stackoverflow.com/questions/58034955/read-only-file-system-when-attempting-mkdir-data-db-on-mac

https://stackoverflow.com/questions/58034955/read-only-file-system-when-attempting-mkdir-data-db-on-mac

macOS 15.x upgrade bug

.zshrc

# mongodb ENV 2020.04.23
# export PATH=/usr/local/mongodb/bin:$PATH
export PATH="$PATH:/usr/local/mongodb/bin:$PATH"
# export PATH=":$PATH:/usr/local/mongodb/bin"

MongoDB GUI tools

  1. MongoDB Compass

  2. Robo 3T

Serverless API

Daas, Database as a Service

  1. MLab

macOS 13.x

mongodb-community@4.2

# brew services
$ brew services list
Name                  Status  User       File
httpd                 started xgqfrms-mm ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist
mongodb-community@4.2 started xgqfrms-mm ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community@4.2.plist
php                   none

# brew services stop

$ brew services stop mongodb-community@4.2
Stopping `mongodb-community@4.2`... (might take a while)
==> Successfully stopped `mongodb-community@4.2` (label: homebrew.mxcl.mongodb-community@

$ brew services list
Name                  Status  User       File
httpd                 started xgqfrms-mm ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist
mongodb-community@4.2 none
php                   none


# brew services start
$ brew services start mongodb-community@4.2

# brew services restart
$ brew services restart mongodb-community@4.2


$ mongo

https://www.cnblogs.com/xgqfrms/p/9770091.html#5132005

(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!

refs

https://stackoverflow.com/questions/30678422/installing-mongodb

https://www.mkyong.com/mongodb/how-to-install-mongodb-on-mac-os-x/

https://coderwall.com/p/fb5dgg/the-best-mongodb-gui-for-mac-os-x

https://treehouse.github.io/installation-guides/mac/mongo-mac.html



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2018-10-11 00:35  xgqfrms  阅读(335)  评论(28编辑  收藏  举报