连接mongodb服务器
来源:互联网 发布:linux虚拟机桥接上网 编辑:程序博客网 时间:2024/05/17 21:41
利用mongodb自带的mongo客户端来连接
先把mongo的二进制文件复制到你所需要的二进制目录下
$ cd www/node/message/data/$ cp /usr/bin/mongo/bin/mongo ./bin/
显示mongo的帮助信息
$ ./bin/mongo --helpMongoDB shell version: 3.2.6usage: ./bin/mongo [options] [db address] [file names (ending in .js)]db address can be: foo foo database on local machine 192.169.0.5/foo foo database on 192.168.0.5 machine 192.169.0.5:9999/foo foo database on 192.168.0.5 machine on port 9999Options: --shell run the shell after executing files --nodb don't connect to mongod on startup - no 'db address' arg expected --norc will not run the ".mongorc.js" file on start up --quiet be less chatty --port arg port to connect to --host arg server to connect to --eval arg evaluate javascript -h [ --help ] show this usage information --version show version information --verbose increase verbosity --ipv6 enable IPv6 support (disabled by default) --disableJavaScriptJIT disable the Javascript Just In Time compiler --enableJavaScriptProtection disable automatic JavaScript function marshalling --ssl use SSL for all connections --sslCAFile arg Certificate Authority file for SSL --sslPEMKeyFile arg PEM certificate/key file for SSL --sslPEMKeyPassword arg password for key in PEM file for SSL --sslCRLFile arg Certificate Revocation List file for SSL --sslAllowInvalidHostnames allow connections to servers with non-matching hostnames --sslAllowInvalidCertificates allow connections to servers with invalid certificates --sslFIPSMode activate FIPS 140-2 mode at startupAuthentication Options: -u [ --username ] arg username for authentication -p [ --password ] arg password for authentication --authenticationDatabase arg user source (defaults to dbname) --authenticationMechanism arg authentication mechanism --gssapiServiceName arg (=mongodb) Service name to use when authenticating using GSSAPI/Kerberos --gssapiHostName arg Remote host name to use for purpose of GSSAPI/Kerberos authenticationfile names: a list of files to run. files have to end in .js and will exit after unless --shell is specified
链接到我们创建好的服务器
$ ./bin/mongo 127.0.0.1:1234/testconnecting to: 127.0.0.1:1234/testWelcome 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-userServer has startup warnings:2016-12-04T06:25:19.460-0500 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.2016-12-04T06:25:19.460-0500 I CONTROL [initandlisten]
接下来我们关闭这个服务器
关闭服务器必须使用admin这个角色去关闭
$ use admin
然后再关闭这个服务器
$ db.shutdownServer()
即可关闭服务器
0 0
- 连接mongodb服务器
- C# 连接MongoDB服务器 并插入数据
- vs2010连接mongodb服务器,X64位
- 使用MongoDB命令连接远程服务器的MongoDB数据库
- 使用MongoDB命令连接远程服务器的MongoDB数据库
- 在本地使用MongoDB命令连接远程服务器的MongoDB
- 使用MongoDB命令连接远程服务器的MongoDB数据库
- Mongodb解决不能连接到服务器的错误
- [mongoDB] error 10061由于目标服务器积极拒绝,无法连接
- 远程连接另一个主机上的MongoDB数据库服务器
- WEB服务器连接不上MONGODB的常用诊断方法
- 远程Linux服务器搭建mongodb,并在本地测试连接
- MongoDB入门(1)--搭建并连接服务器
- 搭建简单的MongoDB服务器并通过mongo连接
- window下mongodb在dos下服务器启动及连接
- Mongodb解决不能连接到服务器的错误
- 解决Mongodb不能连接到服务器的问题
- [ mongoDB ] - MongoDB 连接池
- 使用AFN 进行多次循环网络请求,如何判断何时请求完成
- Java并发系列-21、重入锁死
- LeetCode
- Android 自定义view (一)——attr 理解
- FragmentManager+Fragment实现微信界面布局
- 连接mongodb服务器
- Linux ALSA声卡驱动之八:ASoC架构中的Platform
- android事件分发机制学习1
- Qt 结构体 正则表达 居中显示 页面置顶 页面全局化 标题命名 标题最大化等按钮失效 去标题栏令窗口不可移动
- HDU 3613 Best Reward (加权manacher)
- Block底层分析
- 活动选择
- mongodb简单的数据插入和查询
- 组巡--23G