转载

C100DBA MongoDB 讲解-information can be extracted from rs.status() output?

C100DBA MongoDB 讲解-information can be extracted from rs.status() output?

what useful information can be extracted from rs.status() output?

dbDao 百度贴吧:http://tieba.baidu.com/dbdao

MongoDB技术学习QQ群: 421431253

  1. Data about the node against which rs.status() is run from the perspective of the nodes in the replica set
  2. Data about which server each secondary is syncing from(askmaclean.com)
  3. Data about the state of other nodes in the replica set from the perspective of the node against which rs.status() is run

中文为:

从rs.status()返回的信息中可以获取以下哪些信息?

  1. Replica Set中运行rs.status()的节点的相关数据
  2. 每一个secondary服务器在基于那个服务器做同步
  3. Replica Set中运行rs.status()的节点意外服务器的信息

官方文档对rs.status()的解释是:

This output reflects the current status of the replica set, using data derived from the heartbeat packets sent by the other members of the replica set.

This method provides a wrapper around the replSetGetStatus command. See the documentation of the command for a complete description of the output .

http://docs.mongodb.org/manual/reference/method/rs.status/

官方的解释说明了数据是通过心跳包在replica set复制集的节点间传递的,其反应了replica set的当前状态,所以其不仅仅包括了replica set中本节点的信息(askmaclean.com),

实际rs.status()的样例, “syncingTo” : “rep0.dbdao.com:35001″,反应了secondary服务器在基于谁做同步:

rsdbao:PRIMARY> rs.status() {  "set" : "rsdbao",  "date" : ISODate("2015-05-14T03:07:00.883Z"),  "myState" : 1,  "members" : [   {    "_id" : 0,    "name" : "rep0.dbdao.com:35001",    "health" : 1,    "state" : 1,    "stateStr" : "PRIMARY",    "uptime" : 345,    "optime" : Timestamp(1431572809, 1),    "optimeDate" : ISODate("2015-05-14T03:06:49Z"),    "electionTime" : Timestamp(1431572753, 2),    "electionDate" : ISODate("2015-05-14T03:05:53Z"),    "configVersion" : 3,    "self" : true   },   {    "_id" : 1,    "name" : "rep1.dbdao.com:35001",    "health" : 1,    "state" : 2,    "stateStr" : "SECONDARY",    "uptime" : 22,    "optime" : Timestamp(1431572809, 1),    "optimeDate" : ISODate("2015-05-14T03:06:49Z"),    "lastHeartbeat" : ISODate("2015-05-14T03:07:00.011Z"),    "lastHeartbeatRecv" : ISODate("2015-05-14T03:07:00.650Z"),    "pingMs" : 1,    "syncingTo" : "rep0.dbdao.com:35001",    "configVersion" : 3   },   {    "_id" : 2,    "name" : "rep2.dbdao.com:35001",    "health" : 1,    "state" : 2,    "stateStr" : "SECONDARY",    "uptime" : 10,    "optime" : Timestamp(1431572809, 1),    "optimeDate" : ISODate("2015-05-14T03:06:49Z"),    "lastHeartbeat" : ISODate("2015-05-14T03:07:00.078Z"),    "lastHeartbeatRecv" : ISODate("2015-05-14T03:07:00.228Z"),    "pingMs" : 23,    "configVersion" : 3   }  ],  "ok" : 1 } 

同时早期版本存在rs.status()显示syncingTo信息不正确的问题。

This is a known issue. There is an open ticket about rs.status() showing the primary as syncingTo when run from a secondary if the current primary was a secondary in the past ( SERVER-9989 ). Fix verion is 2.5.1

相关文章 | Related posts:

  1. 快速部署有身份验证和授权的MongoDB Replica SET复制集 在启用身份验证后, MongoDB将强制所有客户端在访问数据库前先做身份验证authentication。 A […]...
  2. 快速部署MongoDB Replica Set复制集 dbDao 百度贴吧:http://tieba.baidu.com/dbdao MongoDB技术学习QQ群: […]...
  3. MongoDB db.collection.remove()方法 mongodb中删除document采用remove方法, http://docs.mongodb.org/m […]...
  4. MongoDB 配置Sharding Cluster 基于Ubuntu 本教程基于Ubuntu 14.04.2 LTS /n /l和mongoDB 3.0, 配置了3个 Config […]...
  5. MongoDB sharding collection 与 unique index dbDao 百度贴吧:http://tieba.baidu.com/dbdao MongoDB技术学习QQ群: […]...
  6. MongoDB索引与排序 对于下面的例子而言,mongoDB会如何处理这个查询?   dbDao 百度贴吧:http://ti […]...
  7. MongoDB 用户角色授权与AUTH启用 MongoDB中几种常用用户角色:   dbDao 百度贴吧:http://tieba.baidu. […]...
  8. mongodb db.collection.remove用法 dbDao 百度贴吧:http://tieba.baidu.com/dbdao MongoDB技术学习QQ群: […]...
  9. MongoDB Aggregation聚集测试 dbDao 百度贴吧:http://tieba.baidu.com/dbdao MongoDB技术学习QQ群: […]...
  10. MongoDB BSONObj size is invalid错误一例 dbDao 百度贴吧:http://tieba.baidu.com/dbdao MongoDB技术学习QQ群: […]...
正文到此结束
Loading...