监控思路:一个是集群成员的健康状态,一个是连接数
1。通过命令rs.status()进行集群内成员健康
<代码> MongoDB企业config-rs: PRIMARY>rs.status () { “设置”:“config-rs”, #副本集已经配置成功 “日期”:ISODate (“2019 - 11 - 23 t04:56:35.588z”), “myState”: 1、 “词”:NumberLong (1), “syncingTo”:“”, “syncSourceHost”:“”, “syncSourceId”:1、 “configsvr”:没错, “heartbeatIntervalMillis”: NumberLong (2000), “majorityVoteCount”: 2 “writeMajorityCount”: 2 " optim ": { " lastCommittedOpTime ": { “t”:时间戳(1574484982,1), “t”: NumberLong (1) }, “lastCommittedWallTime”: ISODate (“2019 - 11 - 23 t04:56:22.464z”), " readConcernMajorityOpTime ": { “t”:时间戳(1574484982,1), “t”: NumberLong (1) }, “readConcernMajorityWallTime”: ISODate (“2019 - 11 - 23 t04:56:22.464z”), " appliedOpTime ": { “t”:时间戳(1574484982,1), “t”: NumberLong (1) }, " durableOpTime ": { “t”:时间戳(1574484982,1), “t”: NumberLong (1) }, “lastAppliedWallTime”: ISODate (“2019 - 11 - 23 t04:56:22.464z”), “lastDurableWallTime”: ISODate (“2019 - 11 - 23 t04:56:22.464z”) }, “lastStableRecoveryTimestamp”:时间戳(1574484952,30), “lastStableCheckpointTimestamp”:时间戳(1574484952,30), " electionCandidateMetrics ": { :“lastElectionReason electionTimeout”, “lastElectionDate”: ISODate (“2019 - 11 - 23 t04:55:51.134z”), “termAtElection”: NumberLong (1), " lastCommittedOpTimeAtElection ": { “t”:时间戳(0,0), “t”: NumberLong (1) }, " lastSeenOpTimeAtElection ": { “t”:时间戳(1574484951,1), “t”: NumberLong (1) }, “numVotesNeeded”: 1、 “priorityAtElection”: 1、 “electionTimeoutMillis”: NumberLong (10000), “newTermStartDate”: ISODate (“2019 - 11 - 23 t04:55:52.141z”), “wMajorityWriteAvailabilityDate”: ISODate (“2019 - 11 - 23 t04:55:52.266z”) }, “成员”:( { “_id”: 0, “名称”:“worker2:27018”, “知识产权”:“192.168.255.134”, “健康”:1、#监控该值,不是1就实现告警 “状态”:1、 “stateStr”:“主”, “运行时间”:722年, " optime ": { “t”:时间戳(1574484982,1), “t”: NumberLong (1) }, “optimeDate”: ISODate (“2019 - 11 - 23 t04:56:22z”), “syncingTo”:“”, “syncSourceHost”:“”, “syncSourceId”:1、 “infoMessage”:“找不到成员同步”, “electionTime”:时间戳(1574484951,2), “electionDate”: ISODate (“2019 - 11 - 23 t04:55:51z”), “configVersion”: 2 “自我”:没错, “lastHeartbeatMessage”:“ }, { “_id”: 1、 “名称”:“worker2:27019”, “知识产权”:“192.168.255.134”, “健康”:1、 “状态”:2 “stateStr”:“二次”, “运行时间”:13日 " optime ": { “t”:时间戳(1574484982,1), “t”: NumberLong (1) }, " optimeDurable ": { “t”:时间戳(1574484982,1), “t”: NumberLong (1) }, “optimeDate”: ISODate (“2019 - 11 - 23 t04:56:22z”), “optimeDurableDate”: ISODate (“2019 - 11 - 23 t04:56:22z”), “lastHeartbeat”: ISODate (“2019 - 11 - 23 t04:56:34.705z”), “lastHeartbeatRecv”: ISODate (“2019 - 11 - 23 t04:56:35.176z”), “pingMs”: NumberLong (0) “lastHeartbeatMessage”:“”, “syncingTo”:“”, “syncSourceHost”:“”, “syncSourceId”:1、 “infoMessage”:“”, “configVersion”: 2 } ], “ok”: 1、 " $ gleStats ": { " lastOpTime ": { “t”:时间戳(1574484982,1), “t”: NumberLong (1) }, “electionId”: ObjectId (“7 fffffff0000000000000001”) }, “lastCommittedOpTime”:时间戳(1574484982,1), " $ clusterTime ": { “clusterTime”:时间戳(1574484982,1), "签名":{ “希”:BinData (0, " AAAAAAAAAAAAAAAAAAAAAAAAAAA="), “keyId”: NumberLong (0) } }, “operationTime”:时间戳(1574484982,1) }代码>
分段说明组
当前副本集名称
日期
执行命令时间
myState
当前节点的状态(角色)
syncingTo
同步源