副本集的replSetGetStatus监控
glc-test:PRIMARY> rs.status() glc-test:PRIMARY> db.adminCommand({replSetGetStatus:1})
glc-test:PRIMARY> db.adminCommand( { replSetGetStatus: 1 } ) { "set" : "glc-test", "date" : ISODate("2020-11-16T06:10:43.118Z"), "myState" : 1, "term" : NumberLong(115), "syncingTo" : "", "syncSourceHost" : "", "syncSourceId" : -1, "heartbeatIntervalMillis" : NumberLong(2000), "optimes" : { "lastCommittedOpTime" : { "ts" : Timestamp(1605507039, 1), "t" : NumberLong(115) }, "readConcernMajorityOpTime" : { "ts" : Timestamp(1605507039, 1), "t" : NumberLong(115) }, "appliedOpTime" : { "ts" : Timestamp(1605507039, 1), "t" : NumberLong(115) }, "durableOpTime" : { "ts" : Timestamp(1605507039, 1), "t" : NumberLong(115) } }, "lastStableCheckpointTimestamp" : Timestamp(1605506999, 1), "electionCandidateMetrics" : { "lastElectionReason" : "stepUpRequestSkipDryRun", "lastElectionDate" : ISODate("2020-11-10T10:05:52.181Z"), "electionTerm" : NumberLong(115), "lastCommittedOpTimeAtElection" : { "ts" : Timestamp(1605002746, 1), "t" : NumberLong(114) }, "lastSeenOpTimeAtElection" : { "ts" : Timestamp(1605002746, 1), "t" : NumberLong(114) }, "numVotesNeeded" : 2, "priorityAtElection" : 1, "electionTimeoutMillis" : NumberLong(10000), "priorPrimaryMemberId" : 0, "numCatchUpOps" : NumberLong(0), "newTermStartDate" : ISODate("2020-11-10T10:05:52.192Z"), "wMajorityWriteAvailabilityDate" : ISODate("2020-11-10T10:05:52.196Z") }, "electionParticipantMetrics" : { "votedForCandidate" : true, "electionTerm" : NumberLong(114), "lastVoteDate" : ISODate("2020-11-10T09:10:06.265Z"), "electionCandidateMemberId" : 0, "voteReason" : "", "lastAppliedOpTimeAtElection" : { "ts" : Timestamp(1604999404, 1), "t" : NumberLong(113) }, "maxAppliedOpTimeInSet" : { "ts" : Timestamp(1604999404, 1), "t" : NumberLong(113) }, "priorityAtElection" : 1 }, "members" : [ { "_id" : 0, "name" : "xxx:28042", "health" : 1, "state" : 2, "stateStr" : "SECONDARY", "uptime" : 273490, "optime" : { "ts" : Timestamp(1605507039, 1), "t" : NumberLong(115) }, "optimeDurable" : { "ts" : Timestamp(1605507039, 1), "t" : NumberLong(115) }, "optimeDate" : ISODate("2020-11-16T06:10:39Z"), "optimeDurableDate" : ISODate("2020-11-16T06:10:39Z"), "lastHeartbeat" : ISODate("2020-11-16T06:10:41.878Z"), "lastHeartbeatRecv" : ISODate("2020-11-16T06:10:42.506Z"), "pingMs" : NumberLong(1), "lastHeartbeatMessage" : "", "syncingTo" : "zzz:28042", "syncSourceHost" : "zzz:28042", "syncSourceId" : 2, "infoMessage" : "", "configVersion" : 3 }, { "_id" : 1, "name" : "yyy:28042", "health" : 1, "state" : 1, "stateStr" : "PRIMARY", "uptime" : 6910118, "optime" : { "ts" : Timestamp(1605507039, 1), "t" : NumberLong(115) }, "optimeDate" : ISODate("2020-11-16T06:10:39Z"), "syncingTo" : "", "syncSourceHost" : "", "syncSourceId" : -1, "infoMessage" : "", "electionTime" : Timestamp(1605002752, 1), "electionDate" : ISODate("2020-11-10T10:05:52Z"), "configVersion" : 3, "self" : true, "lastHeartbeatMessage" : "" }, { "_id" : 2, "name" : "zzz:28042", "health" : 1, "state" : 2, "stateStr" : "SECONDARY", "uptime" : 4736053, "optime" : { "ts" : Timestamp(1605507039, 1), "t" : NumberLong(115) }, "optimeDurable" : { "ts" : Timestamp(1605507039, 1), "t" : NumberLong(115) }, "optimeDate" : ISODate("2020-11-16T06:10:39Z"), "optimeDurableDate" : ISODate("2020-11-16T06:10:39Z"), "lastHeartbeat" : ISODate("2020-11-16T06:10:43.086Z"), "lastHeartbeatRecv" : ISODate("2020-11-16T06:10:41.584Z"), "pingMs" : NumberLong(0), "lastHeartbeatMessage" : "", "syncingTo" : "yyy:28042", "syncSourceHost" : "yyy:28042", "syncSourceId" : 1, "infoMessage" : "", "configVersion" : 3 } ], "ok" : 1, "operationTime" : Timestamp(1605507039, 1), "$clusterTime" : { "clusterTime" : Timestamp(1605507039, 1), "signature" : { "hash" : BinData(0,"tXhOiordhjP3y0HkfnuhSoQ8o7Q="), "keyId" : NumberLong("6856584343653974019") } } } glc-test:PRIMARY>
###############################################################
igoodful@qq.com