mongodb主从配置信息查看与确认

时间:2016-07-23 22:53:51   收藏:0   阅读:776

在local库中不仅有主从日志 oplog集合,还有一个集合用于记录主从配置信息 system.replset:

> use local

> show collections

> db.system.replset.find()

rs1:PRIMARY> use localuse local

switched to db local

rs1:PRIMARY> show collectionsshow collections

me

oplog.rs

replset.election

startup_log

system.replset

rs1:PRIMARY>  db.system.replset.find()db.system.replset.find()

{ "_id" : "rs1", "version" : 1, "protocolVersion" : NumberLong(1), "members" : [ { "_id" : 0, "host" : "localhost:28010", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : {  }, "slaveDelay" : NumberLong(0), "votes" : 1 }, { "_id" : 1, "host" : "localhost:28011", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : {  }, "slaveDelay" : NumberLong(0), "votes" : 1 }, { "_id" : 2, "host" : "localhost:28012", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : {  }, "slaveDelay" : NumberLong(0), "votes" : 1 } ], "settings" : { "chainingAllowed" : true, "heartbeatIntervalMillis" : 2000, "heartbeatTimeoutSecs" : 10, "electionTimeoutMillis" : 10000, "getLastErrorModes" : {  }, "getLastErrorDefaults" : { "w" : 1, "wtimeout" : 0 }, "replicaSetId" : ObjectId("5791ea00a9dbf7228bb1ec0c") } }

rs1:PRIMARY>

 

从这个集合中可以看出,Replica Sets的配置信息,也可从任何已有成员实例上执行 rs.conf() 来查看信息。

原文:http://www.cnblogs.com/iamqiu/p/5699660.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!