mongoBD学习(二)客户端的连接-创新互联

mongo客户端由bin/mongo启动

0、帮助

root@adela-vm:/opt/mongodb_simple# ./bin/mongo --help
MongoDB shell version: 2.6.9
usage: ./bin/mongo [options] [db address] [file names (ending in .js)]

1、启动mongoDB 客户端进程

root@adela-vm:/opt/mongodb_simple# ./bin/mongo 127.0.0.1:12345/test
MongoDB shell version: 2.6.9
connecting to: 127.0.0.1:12345/test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
       http://docs.mongodb.org/
Questions? Try the support group
       http://groups.google.com/group/mongodb-user
>

2、关闭mongoDB 客户端进程
方法1:
>db.shutdownServer()
> db.shutdownServer()
shutdown command only works with the admin database; try 'use admin'
必须要admin才能使用shutdown命令

> use admin
switched to db admin
> db.shutdownServer()
2015-03-27T11:33:49.502+0800 DBClientCursor::init call() failed
server should be down...
2015-03-27T11:33:49.506+0800 trying reconnect to 127.0.0.1:12345 (127.0.0.1) failed
2015-03-27T11:33:49.506+0800 warning: Failed to connect to 127.0.0.1:12345, reason: errno:111 Connection refused
2015-03-27T11:33:49.506+0800 reconnect 127.0.0.1:12345 (127.0.0.1) failed failed couldn't connect to server 127.0.0.1:12345 (127.0.0.1), connection attempt failed
>
方法2:kill -15 进程号或者kill (不加参数)进程号
除非在特殊情况下,避免使用kill -9 进程号

3、重新启动mongo
numactl --interleave=all bin/mongod -f conf/mongod.conf
The program 'numactl' is currently not installed. You can install it by typing:
apt-get install numactl

安装numactl
apt-get install numactl
root@adela-vm:/opt/mongodb_simple/log# apt-get install numactl
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
 numactl
0 upgraded, 1 newly installed, 0 to remove and 348 not upgraded.
Need to get 30.1 kB of archives.
After this operation, 135 kB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/universe numactl amd64 2.0.9~rc5-1ubuntu3 [30.1 kB]
Fetched 30.1 kB in 0s (62.3 kB/s)
Selecting previously unselected package numactl.
(Reading database ... 170689 files and directories currently installed.)
Preparing to unpack .../numactl_2.0.9~rc5-1ubuntu3_amd64.deb ...
Unpacking numactl (2.0.9~rc5-1ubuntu3) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up numactl (2.0.9~rc5-1ubuntu3) ...

重启服务端
root@adela-vm:/opt/mongodb_simple# numactl --interleave=all bin/mongod -f conf/mongod.conf
about to fork child process, waiting until server is ready for connections.
forked process: 4223
child process started successfully, parent exiting

4、查看日志
tail mongod.log
2015-03-27T11:42:38.343+0800 [initandlisten] waiting for connections on port 12345

业务包括:企业网站建设、移动网站建设商城网站开发、网站营销推广等服务,并且涵盖主机域名虚拟主机、云服务器、等互联网基础服务;创新互联联建站以互联网的创新理念,成熟完善的建站体系,开拓进取的精神,专业的解决方案和顾问咨询服务,帮助客户在互联网时代提升形象、把握商机、实现价值,提高企业的核心竞争力。

5、启动客户端

root@adela-vm:/opt/mongodb_simple# ./bin/mongo 127.0.0.1:12345/test
MongoDB shell version: 2.6.9
connecting to: 127.0.0.1:12345/test
>

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


文章标题:mongoBD学习(二)客户端的连接-创新互联
当前URL:http://bzwzjz.com/article/epidp.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 营销网站建设 企业手机网站建设 四川成都网站建设 外贸网站设计方案 成都响应式网站建设公司 响应式网站设计 成都网站设计 网站设计 移动网站建设 手机网站制作 重庆网站制作 重庆企业网站建设 响应式网站建设 网站制作 成都网站建设 网站建设开发 成都网站制作 成都响应式网站建设 成都网站设计 网站建设公司 定制网站设计 成都网站建设