区分连接是mongod 还是mongos 的方式 或者副本集
2016-02-03 15:56
561 查看
db.isMaster()
Detect Connections to
To detect if the MongoDB instance that your client is connectedto is
mongos, use the
isMaster command. When aclient connects to a
mongos,
isMaster returnsa document with a
msg field that holds the stringisdbgrid. For example:{
"ismaster" : true,
"msg" : "isdbgrid",
"maxBsonObjectSize" : 16777216,
"ok" : 1
}
If the application is instead connected to a
mongod, thereturned document does not include the
isdbgrid string.
Detect Connections to
mongos Instances
To detect if the MongoDB instance that your client is connectedto ismongos, use the
isMaster command. When aclient connects to a
mongos,
isMaster returnsa document with a
msg field that holds the stringisdbgrid. For example:{
"ismaster" : true,
"msg" : "isdbgrid",
"maxBsonObjectSize" : 16777216,
"ok" : 1
}
If the application is instead connected to a
mongod, thereturned document does not include the
isdbgrid string.
相关文章推荐
- 过年GO HOME
- beego之orm多条数据插入
- beego和bee的安装、自动生成API框架
- hdu 1847 Good Luck in CET-4 Everybody! 动态规划/巴什博弈
- 用Beego和beego admin开源框架开发的后台管理系统
- mongoose 文档(一) schemas
- 用的是google 的swing ,二维码生成工具类
- golang rbac框架
- Go 1.6 release party
- CDOJ 1271 Search gold
- golang 移动应用例子 example/basic 源码框架分析
- LeetCode Algorithms #206 <Reverse Linked List>
- hdu 1056 HangOver
- django学习心得
- django 的几个操作指令及错误解决方法
- django url调度
- LightOJ--1152--Hiding Gold(二分图奇偶建图)(好题)
- LightOJ--1152--Hiding Gold(二分图奇偶建图)(好题)
- go语言介绍
- MapReduce:超大机群上的简单数据处理(Google三大论文之一)