How can I display which one is the primary mongodb machine from a Secondary replication, without being forced to login to every machine and check?
Running ismaster command only provide that current machine is secondary
rs0:SECONDARY> db.runCommand("ismaster")
{
"hosts" : [
"dbRby1:27017",
"dbRby2:27017",
"dbKrstd1:27017"
],
"setName" : "rs0",
"setVersion" : 5,
"ismaster" : false,
"secondary" : true,
"me" : "dbRby1:27017",
"maxBsonObjectSize" : 16777216,
"maxMessageSizeBytes" : 48000000,
"maxWriteBatchSize" : 1000,
"localTime" : ISODate("2016-11-24T07:36:09.855Z"),
"maxWireVersion" : 4,
"minWireVersion" : 0,
"ok" : 1
}
or by using the rc.conf(), I can't see that either
rs0:SECONDARY> rs.conf()
{
"_id" : "rs0",
"version" : 5,
"protocolVersion" : NumberLong(1),
"members" : [
{
"_id" : 0,
"host" : "dbRby1:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 2,
"tags" : {
},
"slaveDelay" : NumberLong(0),
"votes" : 1
},
{
"_id" : 1,
"host" : "dbRby2:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
},
"slaveDelay" : NumberLong(0),
"votes" : 1
},
{
"_id" : 2,
"host" : "dbKrstd1:27017",
"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" : "majority",
"wtimeout" : 5000
},
"replicaSetId" : ObjectId("5811ec4c70c224f06fba884b")
}
}