如何使用m工具安裝和管理MongoDB
m是一個用於管理MongoDB版本的工具。簡單來說,它可以幫你安裝指定的MongoDB版本。
安裝m:
[root@test /]#npm install -g m
npm http GET
npm http GET
npm http GET
npm ERR! network connect ETIMEDOUT
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! System Linux 2.6.32-696.el6.x86_64
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "m"
npm ERR! cwd /root/20180713/sharding
npm ERR! node -v v0.10.48
npm ERR! npm -v 1.3.6
npm ERR! syscall connect
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /root/20180713/sharding/npm-debug.log
npm ERR! not ok code 0
報錯,請取消代理伺服器配置:
[root@test /]#npm config set strict-ssl false
再次執行:
[root@test /]#npm install -g m
npm http GET
npm http GET
npm http GET
npm http 200
npm http GET /-/m-1.4.1.tgz
npm http 200 /-/m-1.4.1.tgz
/usr/bin/m -> /usr/lib/node_modules/m/bin/m
npm WARN unmet dependency /usr/lib/node_modules/block-stream requires inherits@'~2.0.0' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
npm WARN unmet dependency /usr/lib/node_modules/fstream requires inherits@'~2.0.0' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
npm WARN unmet dependency /usr/lib/node_modules/fstream-ignore requires inherits@'2' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
npm WARN unmet dependency /usr/lib/node_modules/fstream-npm requires inherits@'2' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
npm WARN unmet dependency /usr/lib/node_modules/glob requires inherits@'2' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
npm WARN unmet dependency /usr/lib/node_modules/npmconf requires inherits@'~2.0.0' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
npm WARN unmet dependency /usr/lib/node_modules/tar requires inherits@'2' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
m@1.4.1 /usr/lib/node_modules/m
安裝成功,檢視幫助:
[root@test /]#m --help
Usage: m [options] [COMMAND] [config]
Commands:
m Output versions installed
m stable [config ...] Install or activate the latest stable MongoDB release
m latest [config ...] Install or activate the latest MongoDB release (including dev & RCs)
m X.Y Install or activate the latest patch release for MongoDB X.Y (eg. 3.6)
m <version> [config ...] Install and/or use MongoDB <version>
m custom <version> <tarball> [config ...] Install custom MongoDB <tarball> with [args ...]
m use <version> [args ...] Execute mongod <version> with [args ...]
m shard <version> [args ...] Execute mongos <version> with [args ...]
m shell <version> [args ...] Open a mongo shell <version> with [args ...]
m bin <version> Output bin path for <version>
m rm <version ...> Remove the given version(s)
m --stable Output the latest stable MongoDB version available
m --stable X.Y .. for release series X.Y (eg. 3.6)
m --latest Output the latest MongoDB version available (including dev & RCs)
m --latest X.Y .. for release series X.Y (eg. 3.6)
m ls Output the versions of MongoDB available
m installed [--json] Output installed versions available (optionally, in JSON format)
m src <version> Output the url for source used for the given <version>
(useful if installed from source)
m pre <event> [script] Declare one or list scripts to execute before <event>
(scripts must use absolute paths)
m post <event> [script] Declare one or list scripts to execute after <event>
(scripts must use absolute paths)
m pre <event> rm [script] Remove pre <event> script
m post <event> rm [script] Remove post <event> script
Events:
change Occurs when switching MongoDB versions
install Occurs when installing a previously uninstalled MongoDB version
Options:
-V, --version Output current version of m
-h, --help Display help information
Aliases:
which bin
use as, mongod
shard sd, mongos
list ls
installed lls
custom c
shell s, sh, mongo
執行m命令:
[root@test /]#m
No installed versions
提示沒有安裝任何版本:
安裝3.4版本:
[root@test /]#m 3.4
Checking for latest release of MongoDB 3.4
MongoDB version 3.4.16 is not installed.
Installation may take a while. Would you like to proceed? [Y/n] y
... installing binary
######################################################################## 100.0%
/root/20180713/sharding
... removing source
Activating 3.4.16
... installation complete
獲取3.4.16安裝後所在的目錄:
[root@test ~/]#m bin 3.4.16
/usr/local/m/versions/3.4.16/bin
進入目錄:
[root@test /]#cd /usr/local/m/versions/3.4.16/bin
[root@test /usr/local/m/versions/3.4.16/bin]#ll
total 231684
-rwxr-xr-x 1 root root 4630751 Jul 10 14:08 bsondump
-rwxr-xr-x 1 root root 29471624 Jul 10 14:19 mongo
-rwxr-xr-x 1 root root 54088464 Jul 10 14:19 mongod
-rwxr-xr-x 1 root root 8344535 Jul 10 14:08 mongodump
-rwxr-xr-x 1 root root 6340189 Jul 10 14:08 mongoexport
-rwxr-xr-x 1 root root 6204308 Jul 10 14:08 mongofiles
-rwxr-xr-x 1 root root 6485366 Jul 10 14:08 mongoimport
-rwxr-xr-x 1 root root 5984601 Jul 10 14:08 mongooplog
-rwxr-xr-x 1 root root 53464744 Jul 10 14:19 mongoperf
-rwxr-xr-x 1 root root 9177984 Jul 10 14:09 mongoreplay
-rwxr-xr-x 1 root root 9506704 Jul 10 14:08 mongorestore
-rwxr-xr-x 1 root root 30763024 Jul 10 14:19 mongos
-rwxr-xr-x 1 root root 6560233 Jul 10 14:08 mongostat
-rwxr-xr-x 1 root root 6193511 Jul 10 14:08 mongotop
執行mongodb:
[root@test /usr/local/m/versions/3.4.16/bin]#./mongo
MongoDB shell version v3.4.16
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.13
Server has startup warnings:
2018-06-05T16:45:25.725+0800 I STORAGE [initandlisten]
2018-06-05T16:45:25.725+0800 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2018-06-05T16:45:25.725+0800 I STORAGE [initandlisten] ** See
2018-06-05T16:45:26.786+0800 I CONTROL [initandlisten]
2018-06-05T16:45:26.786+0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-06-05T16:45:26.786+0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-06-05T16:45:26.786+0800 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2018-06-05T16:45:26.786+0800 I CONTROL [initandlisten]
2018-06-05T16:45:26.786+0800 I CONTROL [initandlisten]
2018-06-05T16:45:26.786+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2018-06-05T16:45:26.787+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2018-06-05T16:45:26.787+0800 I CONTROL [initandlisten]
2018-06-05T16:45:26.787+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2018-06-05T16:45:26.787+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2018-06-05T16:45:26.787+0800 I CONTROL [initandlisten]
> show dbs
chenfeng 0.003GB
local 0.000GB
test 0.003GB
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-2157823/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MongoDB 管理工具Robomongo下載與安裝MongoDB
- mongodb macos 下的安裝和使用MongoDBMac
- vnc管理工具,vnc管理工具安裝使用教程,linux如何安裝vnc server?VNCLinuxServer
- Win7下MongoDB的安裝和使用Win7MongoDB
- MAC上如何安裝mongoDBMacMongoDB
- 安裝和使用LogMiner工具
- mongodb的安裝以及使用MongoDB
- mongodb的安裝配置,使用MongoDB
- docker安裝mongoDB及使用DockerMongoDB
- 如何安裝和使用DockerDocker
- [ Module ] 環境變數管理工具 Module 安裝和使用變數
- 如何在 Ubuntu 上安裝 MongoDBUbuntuMongoDB
- Mongodb安裝篇+視覺化工具篇MongoDB視覺化
- 【Mac】M晶片Mac如何安裝rosetta?Mac晶片ROS
- 【mongodb】mongodb的安裝MongoDB
- 如何安裝MongoDB併成功啟動MongoDB
- mongodb 安裝MongoDB
- 安裝mongodbMongoDB
- MongoDB安裝MongoDB
- mongodb 安裝MongoDB
- Go 包管理工具 dep 安裝與使用Go
- 程式管理程式supervisor安裝和使用
- mongodb的安裝和啟動方法MongoDB
- 使用Yum安裝MongoDB Linux版MongoDBLinux
- 如何安裝rlwrap工具
- 快速掌握mongoDB(一)——mongoDB安裝部署和常用shell命令MongoDB
- mongodb管理工具MongoDB
- 開源Docker管理工具kubernetes的簡易安裝和使用Docker
- MySQL學習(二)圖形介面管理工具Navicat for MySQL安裝和使用MySql
- 在Red Hat和Centos上安裝MongoDBCentOSMongoDB
- Docker安裝mongodbDockerMongoDB
- 【mongodb安裝配置】MongoDB
- MAC 安裝 MongoDBMacMongoDB
- MongoDB的安裝MongoDB
- Mac安裝MongoDBMacMongoDB
- mongodb 3.2.0.4安裝MongoDB
- centos安裝mongodbCentOSMongoDB
- 【mongodb】安裝pymongoMongoDB