分享更有价值
被信任是一种快乐

怎么使用m工具安装和管理MongoDB

文章页正文上

小编给大家分享一下怎么使用m工具安装和管理MongoDB,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!m是一个用于管理MongoDB版本的工具。简单来说,它可以帮你安装指定的MongoDB版本。安装m:[root@test /]#npm install -g mnpm http GET https://registry.npmjs.org/mnpm http GET https://registry.npmjs.org/mnpm http GET https://registry.npmjs.org/mnpm ERR! network connect ETIMEDOUTnpm ERR! network This is most likely not a problem with npm itselfnpm 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! networknpm ERR! network If you are behind a proxy, please make sure that thenpm ERR! network ‘proxy’ config is set properly. See: ‘npm help config’npm ERR! System Linux 2.6.32-696.el6.x86_64npm ERR! command “node” “/usr/bin/npm” “install” “-g” “m”npm ERR! cwd /root/20180713/shardingnpm ERR! node -v v0.10.48npm ERR! npm -v 1.3.6npm ERR! syscall connectnpm ERR! code ETIMEDOUTnpm ERR! errno ETIMEDOUTnpm ERR!npm ERR! Additional logging details can be found in:npm ERR! /root/20180713/sharding/npm-debug.lognpm ERR! not ok code 0报错,请取消代理服务器配置:[root@test /]#npm config set strict-ssl false再次运行:[root@test /]#npm install -g mnpm http GET https://registry.npmjs.org/mnpm http GET https://registry.npmjs.org/mnpm http GET https://registry.npmjs.org/mnpm http 200 https://registry.npmjs.org/mnpm http GET https://registry.npmjs.org/m/-/m-1.4.1.tgznpm http 200 https://registry.npmjs.org/m/-/m-1.4.1.tgz/usr/bin/m -> /usr/lib/node_modules/m/bin/mnpm WARN unmet dependency /usr/lib/node_modules/block-stream requires inherits@’~2.0.0′ but will loadnpm WARN unmet dependency undefined,npm WARN unmet dependency which is version undefinednpm WARN unmet dependency /usr/lib/node_modules/fstream requires inherits@’~2.0.0′ but will loadnpm WARN unmet dependency undefined,npm WARN unmet dependency which is version undefinednpm WARN unmet dependency /usr/lib/node_modules/fstream-ignore requires inherits@’2′ but will loadnpm WARN unmet dependency undefined,npm WARN unmet dependency which is version undefinednpm WARN unmet dependency /usr/lib/node_modules/fstream-npm requires inherits@’2′ but will loadnpm WARN unmet dependency undefined,npm WARN unmet dependency which is version undefinednpm WARN unmet dependency /usr/lib/node_modules/glob requires inherits@’2′ but will loadnpm WARN unmet dependency undefined,npm WARN unmet dependency which is version undefinednpm WARN unmet dependency /usr/lib/node_modules/npmconf requires inherits@’~2.0.0′ but will loadnpm WARN unmet dependency undefined,npm WARN unmet dependency which is version undefinednpm WARN unmet dependency /usr/lib/node_modules/tar requires inherits@’2’ but will loadnpm WARN unmet dependency undefined,npm WARN unmet dependency which is version undefinedm@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 [config …] Install and/or use MongoDB m custom [config …] Install custom MongoDB with [args …] m use [args …] Execute mongod with [args …] m shard [args …] Execute mongos with [args …] m shell [args …] Open a mongo shell with [args …] m bin Output bin path for m rm 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 Output the url for source used for the given (useful if installed from source) m pre [script] Declare one or list scripts to execute before (scripts must use absolute paths) m post [script] Declare one or list scripts to execute after (scripts must use absolute paths) m pre rm [script] Remove pre script m post rm [script] Remove post 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 /]#mNo installed versions提示没有安装任何版本:安装3.4版本:[root@test /]#m 3.4Checking for latest release of MongoDB 3.4MongoDB 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 sourceActivating 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]#lltotal 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 30763免费主机域名024 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]#./mongoMongoDB shell version v3.4.16connecting to: mongodb://127.0.0.1:27017MongoDB server version: 3.4.13Server 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 engine2018-06-05T16:45:25.725+0800 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem2018-06-05T16:45:26.786+0800 I CONTROL [initandlisten]2018-06-05T16:45:26.786+0800 I CONTROL [initandlisten] ** WARNING: Access control is not enable免费主机域名d 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 dbschenfeng 0.003GBlocal 0.000GBtest 0.003GB看完了这篇文章,相信你对“怎么使用m工具安装和管理MongoDB”有了一定的了解,如果想了解更多相关知识,欢迎关注云技术行业资讯频道,感谢各位的阅读!

相关推荐: MySQL运行原理与基础架构是什么

本篇内容主要讲解“MySQL运行原理与基础架构是什么”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“MySQL运行原理与基础架构是什么”吧!下面是关于上述部件的介绍:connectors与其他编程语言中的sql 语句…

文章页内容下
赞(0) 打赏
版权声明:本站采用知识共享、学习交流,不允许用于商业用途;文章由发布者自行承担一切责任,与本站无关。
文章页正文下
文章页评论上

云服务器、web空间可免费试用

宝塔面板主机、支持php,mysql等,SSL部署;安全高速企业专供99.999%稳定,另有高防主机、不限制内容等类型,具体可咨询QQ:360163164,Tel同微信:18905205712

主机选购导航云服务器试用

登录

找回密码

注册