Skip to content

Instantly share code, notes, and snippets.

@sarjarapu
Last active June 15, 2018 06:02
Show Gist options
  • Save sarjarapu/c8471bf27f4334681fc1b59c229246db to your computer and use it in GitHub Desktop.
Save sarjarapu/c8471bf27f4334681fc1b59c229246db to your computer and use it in GitHub Desktop.
A JavaScript function call showing the replica set status information
rs.status()
/*
{
"set": "rs0",
"date": ISODate("2018-06-15T00:57:24.708Z"),
"myState": 1,
"term": NumberLong(1),
"heartbeatIntervalMillis": NumberLong(2000),
"optimes": {
"lastCommittedOpTime": {
"ts": Timestamp(1529024241, 1),
"t": NumberLong(1)
},
"readConcernMajorityOpTime": {
"ts": Timestamp(1529024241, 1),
"t": NumberLong(1)
},
"appliedOpTime": {
"ts": Timestamp(1529024241, 1),
"t": NumberLong(1)
},
"durableOpTime": {
"ts": Timestamp(1529024241, 1),
"t": NumberLong(1)
}
},
"members": [{
"_id": 0,
"name": "mon01:27000",
"health": 1,
"state": 1,
"stateStr": "PRIMARY",
"uptime": 1837,
"optime": {
"ts": Timestamp(1529024241, 1),
"t": NumberLong(1)
},
"optimeDate": ISODate("2018-06-15T00:57:21Z"),
"electionTime": Timestamp(1529022829, 1),
"electionDate": ISODate("2018-06-15T00:33:49Z"),
"configVersion": 1,
"self": true
},
{
"_id": 1,
"name": "mon02:27000",
"health": 1,
"state": 2,
"stateStr": "SECONDARY",
"uptime": 1425,
"optime": {
"ts": Timestamp(1529024241, 1),
"t": NumberLong(1)
},
"optimeDurable": {
"ts": Timestamp(1529024241, 1),
"t": NumberLong(1)
},
"optimeDate": ISODate("2018-06-15T00:57:21Z"),
"optimeDurableDate": ISODate("2018-06-15T00:57:21Z"),
"lastHeartbeat": ISODate("2018-06-15T00:57:24.663Z"),
"lastHeartbeatRecv": ISODate("2018-06-15T00:57:23.502Z"),
"pingMs": NumberLong(0),
"syncingTo": "mon01:27000",
"configVersion": 1
},
{
"_id": 2,
"name": "mon03:27000",
"health": 1,
"state": 2,
"stateStr": "SECONDARY",
"uptime": 1425,
"optime": {
"ts": Timestamp(1529024241, 1),
"t": NumberLong(1)
},
"optimeDurable": {
"ts": Timestamp(1529024241, 1),
"t": NumberLong(1)
},
"optimeDate": ISODate("2018-06-15T00:57:21Z"),
"optimeDurableDate": ISODate("2018-06-15T00:57:21Z"),
"lastHeartbeat": ISODate("2018-06-15T00:57:24.571Z"),
"lastHeartbeatRecv": ISODate("2018-06-15T00:57:23.075Z"),
"pingMs": NumberLong(75),
"syncingTo": "mon01:27000",
"configVersion": 1
}
],
"ok": 1,
"operationTime": Timestamp(1529024241, 1),
"$clusterTime": {
"clusterTime": Timestamp(1529024241, 1),
"signature": {
"hash": BinData(0, "AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId": NumberLong(0)
}
}
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment