如何安装和使用
https://www.runoob.com/mongodb/mongodb-osx-install.html
由于上面的介绍中下载太难了,所以从这个地址下载安装
https://www.mongodb.org/dl/osx?_ga=2.75375826.1742330598.1529906400-2028134612.1529906400
- 解压后安装配置
# 进入 /usr/local
cd /usr/local
# 下载
sudo curl -O https://fastdl.mongodb.org/osx/mongodb-osx-x86_64-3.4.2.tgz
# 解压
sudo tar -zxvf mongodb-osx-x86_64-3.4.2.tgz
# 重命名为 mongodb 目录
sudo mv mongodb-osx-x86_64-3.4.2 mongodb
- 启动
$ mongod --dbpath /Volumes/derkinssh/derkinmongodb
2018-06-29T13:43:37.176+0800 I CONTROL [initandlisten] MongoDB starting : pid=30496 port=27017 dbpath=/Volumes/derkinssh/derkinmongodb 64-bit host=derkins-imac.local
2018-06-29T13:43:37.177+0800 I CONTROL [initandlisten] db version v3.4.15-56-gc50dd60
2018-06-29T13:43:37.177+0800 I CONTROL [initandlisten] git version: c50dd604f81a7464389ffa1ac5c7ba8f0b471d24
2018-06-29T13:43:37.177+0800 I CONTROL [initandlisten] allocator: system
2018-06-29T13:43:37.177+0800 I CONTROL [initandlisten] modules: none
2018-06-29T13:43:37.177+0800 I CONTROL [initandlisten] build environment:
2018-06-29T13:43:37.177+0800 I CONTROL [initandlisten] distarch: x86_64
2018-06-29T13:43:37.177+0800 I CONTROL [initandlisten] target_arch: x86_64
2018-06-29T13:43:37.178+0800 I CONTROL [initandlisten] options: { storage: { dbPath: "/Volumes/derkinssh/derkinmongodb" } }
2018-06-29T13:43:37.180+0800 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=3584M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),verbose=(recovery_progress),
2018-06-29T13:43:38.165+0800 I CONTROL [initandlisten]
2018-06-29T13:43:38.165+0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-06-29T13:43:38.165+0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-06-29T13:43:38.165+0800 I CONTROL [initandlisten]
2018-06-29T13:43:38.597+0800 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/Volumes/derkinssh/derkinmongodb/diagnostic.data'
2018-06-29T13:43:38.614+0800 I INDEX [initandlisten] build index on: admin.system.version properties: { v: 2, key: { version: 1 }, name: "incompatible_with_version_32", ns: "admin.system.version" }
2018-06-29T13:43:38.614+0800 I INDEX [initandlisten] building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2018-06-29T13:43:38.618+0800 I INDEX [initandlisten] build index done. scanned 0 total records. 0 secs
2018-06-29T13:43:38.619+0800 I COMMAND [initandlisten] setting featureCompatibilityVersion to 3.4
2018-06-29T13:43:38.619+0800 I NETWORK [thread1] waiting for connections on port 27017