replSetGetStatuscommand returns the status of the replica set from the point of view of the server that processed the command.
replSetGetStatusmust be run against the admin database. The command has the following prototype form:
Data provided by this command derives from data included in heartbeats sent to the server by other members of the replica set. Because of the frequency of heartbeats, these data can be several seconds out of date.
The command returns the following output for an example replica set primary:
The following example runs the
replSetGetStatus command on the admin database of the replica set primary. In this example, the optional
initialSync: 1 is included in the command (you can omit if you do not want to return the initial sync status):
The command returns the following output for an example replica set secondary: