码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2016-07-23 22:56:07      阅读:431      评论:0      收藏:0      [点我收藏+]

标签:

在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() 来查看信息。

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

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!