Database Manual / Reference / Database Commands / Replication

replSetGetStatus (database command数据库命令)

Definition定义

replSetGetStatus

The replSetGetStatus command returns the status of the replica set from the point of view of the server that processed the command. replSetGetStatus must be run on the admin database.replSetGetStatus命令从处理该命令的服务器的角度返回副本集的状态。replSetGetStatus必须在admin数据库上运行。

The mongod instance must be a replica set member for replSetGetStatus to return successfully.mongod实例必须是副本集成员,replSetGetStatus才能成功返回。

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.此命令提供的数据来源于副本集其他成员发送到服务器的心跳中包含的数据。由于心跳的频率,这些数据可能会过时几秒钟。

Tip

In mongosh, this command can also be run through the rs.status() helper method.mongosh中,此命令也可以通过rs.status()辅助方法运行。

Helper methods are convenient for mongosh users, but they may not return the same level of information as database commands. 助手方法对mongosh用户来说很方便,但它们可能不会返回与数据库命令相同级别的信息。In cases where the convenience is not needed or the additional return fields are required, use the database command.如果不需要便利性或需要额外的返回字段,请使用database命令。

Compatibility兼容性

This command is available in deployments hosted in the following environments:此命令在以下环境中托管的部署中可用:

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud:云中MongoDB部署的完全托管服务

Important

This command is not supported in M0 and Flex clusters. For more information, see Unsupported Commands.M0和Flex集群不支持此命令。有关详细信息,请参阅不支持的命令

  • MongoDB Enterprise: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本
  • MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本

Syntax语法

The command has the following syntax:该命令具有以下语法:

db.adminCommand(
{
replSetGetStatus: 1
}
)

If you run replSetGetStatus or the mongosh helper rs.status() on a member during its initial sync (i.e. STARTUP2 state), the command returns replSetGetStatus.initialSyncStatus metrics.如果在成员的初始同步(即STARTUP2状态)期间对其运行replSetGetStatusmongosh辅助程序rs.status(),则该命令将返回replSetGetStatus.initialSyncStatus度量。

After the member completes the initial synchronization and transitions to another state, the replSetGetStatus.initialSyncStatus metrics are no longer available.在成员完成初始同步并转换到另一个状态后,replSetGetStatus.initialSyncStatus初始同步状态度量不再可用。

Note

If you haven't yet initialized your replica set, the replSetGetStatus command returns the following error:如果您尚未初始化副本集,initialized命令将返回以下错误:

MongoServerError: no replset config has been received

Run the replSetInitiate command and try again.运行replSetInitiate命令,然后重试。

Example示例

Primary

The following example runs the replSetGetStatus command on the admin database of the replica set primary:以下示例在复制集主的admin数据库上运行replSetGetStatus命令:

db.adminCommand( { replSetGetStatus: 1 } )

The command returns the following output for an example replica set primary:该命令为示例副本集主返回以下输出:

{
"set" : "replset",
"date" : ISODate("2024-08-15T23:06:13.978Z"),
"myState" : 1,
"term" : Long(3),
"syncSourceHost" : "",
"syncSourceId" : -1,
"heartbeatIntervalMillis" : Long(2000),
"majorityVoteCount" : 2,
"writeMajorityCount" : 2,
"votingMembersCount" : 3,
"writableVotingMembersCount" : 3,
"optimes" : {
"lastCommittedOpTime" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"lastCommittedWallTime" : ISODate("2024-08-15T23:06:13.978Z"),
"readConcernMajorityOpTime" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"readConcernMajorityWallTime" : ISODate("2024-08-15T23:06:13.978Z"),
"appliedOpTime" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"writtenOpTime" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"durableOpTime" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"lastAppliedWallTime" : ISODate("2024-08-15T23:06:13.978Z"),
"lastWrittenWallTime" : ISODate("2024-08-15T23:06:13.978Z"),
"lastDurableWallTime" : ISODate("2024-08-15T23:06:13.978Z")
},
"lastStableRecoveryTimestamp" : Timestamp(1723763173, 1),
"electionCandidateMetrics" : {
"lastElectionReason" : "stepUpRequestSkipDryRun",
"lastElectionDate" : ISODate("2024-08-15T23:06:13.978Z"),
"electionTerm" : Long(3),
"lastCommittedOpTimeAtElection" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(2)
},
"lastSeenOpTimeAtElection" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(2)
},
"lastSeenWrittenOpTimeAtElection" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(1)
},
"numVotesNeeded" : 2,
"priorityAtElection" : 1,
"electionTimeoutMillis" : Long(10000),
"priorPrimaryMemberId" : 1,
"numCatchUpOps" : Long(0),
"newTermStartDate" : ISODate("2024-08-15T23:06:13.978Z"),
"wMajorityWriteAvailabilityDate" : ISODate("2024-08-15T23:06:13.978Z")
},
"electionParticipantMetrics" : {
"votedForCandidate" : true,
"electionTerm" : Long(2),
"lastVoteDate" : ISODate("2024-08-15T23:06:13.978Z"),
"electionCandidateMemberId" : 1,
"voteReason" : "",
"lastAppliedOpTimeAtElection" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(1)
},
"lastWrittenOpTimeAtElection" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(1)
},
"maxAppliedOpTimeInSet" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(1)
},
"priorityAtElection" : 1
},
"members" : [
{
"_id" : 0,
"name" : "m1.example.net:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 269,
"optime" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeWritten" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeDurable" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeDate" : ISODate("2024-08-15T23:06:13.978Z"),
"optimeWrittenDate" : ISODate("2024-08-15T23:06:13.978Z"),
"lastAppliedWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"lastWrittenWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"lastDurableWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"syncSourceHost" : "",
"syncSourceId" : -1,
"infoMessage" : "",
"electionTime" : Timestamp(1723763173, 1),
"electionDate" : ISODate("2024-08-15T23:06:13.978Z"),
"configVersion" : 1,
"configTerm" : 0,
"self" : true,
"lastHeartbeatMessage" : ""
},
{
"_id" : 1,
"name" : "m2.example.net:27017",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 266,
"optime" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeWritten" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeDurable" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeDate" : ISODate("2024-08-15T23:06:13.978Z"),
"optimeWrittenDate" : ISODate("2024-08-15T23:06:13.978Z"),
"optimeDurableDate" : ISODate("2024-08-15T23:06:13.978Z"),
"lastAppliedWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"lastWrittenWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"lastDurableWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"lastHeartbeat" : ISODate("2024-08-15T23:06:13.978Z"),
"lastHeartbeatRecv" : ISODate("2024-08-15T23:06:13.978Z"),
"pingMs" : Long(0),
"lastHeartbeatMessage" : "",
"syncSourceHost" : "m3.example.net:27017",
"syncSourceId" : 2,
"infoMessage" : "",
"configVersion" : 1
},
{
"_id" : 2,
"name" : "m3.example.net:27017",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 266,
"optime" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeWritten" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeDurable" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeDate" : ISODate("2024-08-15T23:06:13.978Z"),
"optimeWrittenDate" : ISODate("2024-08-15T23:06:13.978Z"),
"optimeDurableDate" : ISODate("2024-08-15T23:06:13.978Z"),
"lastAppliedWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"lastWrittenWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"lastDurableWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"lastHeartbeat" : ISODate("2024-08-15T23:06:13.978Z"),
"lastHeartbeatRecv" : ISODate("2024-08-15T23:06:13.978Z"),
"pingMs" : Long(0),
"lastHeartbeatMessage" : "",
"syncSourceHost" : "m1.example.net:27017",
"syncSourceId" : 0,
"infoMessage" : "",
"configVersion" : 1
}
],
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1723763173, 1),
"signature" : {
"hash" : BinData(0,"9C2qcGVkipEGJW3iF90qxb/gIwc="),
"keyId" : Long("6800589497806356482")
}
},
"operationTime" : Timestamp(1723763173, 1)
}
Secondary

The following example runs the replSetGetStatus command on the admin database of the replica set secondary:以下示例在副本集辅助的admin数据库上运行replSetGetStatus命令:

db.adminCommand( { replSetGetStatus: 1 } )

The command returns the following output for an example replica set secondary:对于示例副本集辅助,该命令返回以下输出:

{
"set" : "replset",
"date" : ISODate("2024-08-15T23:06:13.978Z"),
"myState" : 2,
"term" : Long(3),
"syncSourceHost" : "m3.example.net:27017",
"syncSourceId" : 2,
"heartbeatIntervalMillis" : Long(2000),
"majorityVoteCount" : 2,
"writeMajorityCount" : 2,
"votingMembersCount" : 3,
"writableVotingMembersCount" : 3,
"optimes" : {
"lastCommittedOpTime" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"lastCommittedWallTime" : ISODate("2024-08-15T23:06:13.978Z"),
"readConcernMajorityOpTime" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"readConcernMajorityWallTime" : ISODate("2024-08-15T23:06:13.978Z"),
"appliedOpTime" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"writtenOpTime" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"durableOpTime" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"lastAppliedWallTime" : ISODate("2024-08-15T23:06:13.978Z"),
"lastWrittenWallTime" : ISODate("2024-08-15T23:06:13.978Z"),
"lastDurableWallTime" : ISODate("2024-08-15T23:06:13.978Z")
},
"lastStableRecoveryTimestamp" : Timestamp(1723763173, 1),
"electionParticipantMetrics" : {
"votedForCandidate" : true,
"electionTerm" : Long(3),
"lastVoteDate" : ISODate("2024-08-15T23:06:13.978Z"),
"electionCandidateMemberId" : 0,
"voteReason" : "",
"lastAppliedOpTimeAtElection" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(2)
},
"lastWrittenOpTimeAtElection" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(1)
},
"maxAppliedOpTimeInSet" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(2)
},
"maxWrittenOpTimeInSet" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(1)
},
"priorityAtElection" : 1,
"newTermStartDate" : ISODate("2024-08-15T23:06:13.978Z"),
"newTermAppliedDate" : ISODate("2024-08-15T23:06:13.978Z")
},
"members" : [
{
"_id" : 0,
"name" : "m1.example.net:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 407,
"optime" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeWritten" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeDurable" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeDate" : ISODate("2024-08-15T23:06:13.978Z"),
"optimeWrittenDate" : ISODate("2024-08-15T23:06:13.978Z"),
"optimeDurableDate" : ISODate("2024-08-15T23:06:13.978Z"),
"lastAppliedWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"lastWrittenWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"lastDurableWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"lastHeartbeat" : ISODate("2024-08-15T23:06:13.978Z"),
"lastHeartbeatRecv" : ISODate("2024-08-15T23:06:13.978Z"),
"pingMs" : Long(0),
"lastHeartbeatMessage" : "",
"syncSourceHost" : "",
"syncSourceId" : -1,
"infoMessage" : "",
"electionTime" : Timestamp(1723763173, 1),
"electionDate" : ISODate("2024-08-15T23:06:13.978Z"),
"configVersion" : 1
},
{
"_id" : 1,
"name" : "m2.example.net:27017",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 409,
"optime" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeWritten" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeDurable" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeDate" : ISODate("2024-08-15T23:06:13.978Z"),
"optimeWrittenDate" : ISODate("2024-08-15T23:06:13.978Z"),
"lastAppliedWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"lastWrittenWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"lastDurableWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"syncSourceHost" : "m3.example.net:27017",
"syncSourceId" : 2,
"infoMessage" : "",
"configVersion" : 1,
"configTerm" : 0,
"self" : true,
"lastHeartbeatMessage" : ""
},
{
"_id" : 2,
"name" : "m3.example.net:27017",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 407,
"optime" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeWritten" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeDurable" : {
"ts" : Timestamp(1723763173, 1),
"t" : Long(3)
},
"optimeDate" : ISODate("2024-08-15T23:06:13.978Z"),
"optimeWrittenDate" : ISODate("2024-08-15T23:06:13.978Z"),
"optimeDurableDate" : ISODate("2024-08-15T23:06:13.978Z"),
"lastAppliedWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"lastWrittenWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"lastDurableWallTime": ISODate("2024-08-15T23:06:13.978Z"),
"lastHeartbeat" : ISODate("2024-08-15T23:06:13.978Z"),
"lastHeartbeatRecv" : ISODate("2024-08-15T23:06:13.978Z"),
"pingMs" : Long(0),
"lastHeartbeatMessage" : "",
"syncSourceHost" : "m1.example.net:27017",
"syncSourceId" : 0,
"infoMessage" : "",
"configVersion" : 1
}
],
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1723763173, 1),
"signature" : {
"hash" : BinData(0,"kmhE5YARZlzn/DX4B/D0E5P6okY="),
"keyId" : Long("6800589497806356482")
}
},
"operationTime" : Timestamp(1723763173, 1),
}
In earlier versions (3.6.x-4.2.0)在早期版本(3.6x-4.2.0)中

You can include the optional initialSync: 1 to include the replSetGetStatus.initialSyncStatus in the output (you can omit if you do not want to return the initial sync status):您可以包含可选的initialSync:1,以在输出中包含replSetGetStatus.initialSyncStatus(如果不想返回初始同步状态,可以省略):

db.adminCommand( { replSetGetStatus: 1, initialSync: 1 } )
Include Intial Sync Metrics
Starting in MongoDB 5.2,从MongoDB 5.2开始,
the replSetGetStatus.initialSyncStatus document contains additional fields when using a file copy based initial sync.使用基于文件副本的初始同步时,replSetGetStatus.initialSyncStatus文档包含其他字段

If you run replSetGetStatus on a member during its initial sync, the command returns replSetGetStatus.initialSyncStatus metrics.如果在成员的初始同步期间对其运行replSetGetStatus,则该命令将返回replSetGetStatus.initialSyncStatus度量。

db.adminCommand( { replSetGetStatus: 1 } )

After the member completes the initial synchronization and transitions to another state, the replSetGetStatus.initialSyncStatus metrics are no longer available.在成员完成初始同步并转换到另一个状态后,replSetGetStatus.initialSyncStatus初始同步状态度量不再可用。

The following example runs the replSetGetStatus command on the admin database of the 4.4 replica set member during its initial sync:以下示例在4.4副本集成员的admin数据库的初始同步期间运行replSetGetStatus命令:

{
"set" : "replset",
"date" : ISODate("2024-08-15T23:06:13.978Z")
"myState" : 5,
"term" : Long(1),
"syncSourceHost" : "m1.example.net:27017",
"syncSourceId" : 0,
"heartbeatIntervalMillis" : Long(2000),
"majorityVoteCount" : 2,
"writeMajorityCount" : 2,
"votingMembersCount" : 2,
"writableVotingMembersCount" : 2,
"optimes" : {
"lastCommittedOpTime" : {
"ts" : Timestamp(0, 0),
"t" : Long(-1)
},
"lastCommittedWallTime" : ISODate("1970-01-01T00:00:00Z"),
"appliedOpTime" : {
"ts" : Timestamp(0, 0),
"t" : Long(-1)
},
"writtenOpTime": {
"ts" : Timestamp(0, 0),
"t" : Long(-1)
},
"durableOpTime" : {
"ts" : Timestamp(0, 0),
"t" : Long(-1)
},
"lastAppliedWallTime" : ISODate("1970-01-01T00:00:00Z"),
"lastWrittenWallTime": ISODate("1970-01-01T00:00:00Z"),
"lastDurableWallTime" : ISODate("1970-01-01T00:00:00Z")
},
"lastStableRecoveryTimestamp" : Timestamp(0, 0),
"initialSyncStatus" : {
"failedInitialSyncAttempts" : 0,
"maxFailedInitialSyncAttempts" : 10,
"initialSyncStart" : ISODate("2024-08-15T23:06:13.978Z"),
"initialSyncAttempts" : [ ],
"appliedOps" : 0,
"initialSyncOplogStart" : Timestamp(1723763173, 1),
"syncSourceUnreachableSince" : ISODate("2024-08-15T23:06:13.978Z"),
"currentOutageDurationMillis" : Long(8687),
"totalTimeUnreachableMillis" : Long(8687),
"databases" : {
"databasesCloned" : 3,
"admin" : {
"collections" : 4,
"clonedCollections" : 4,
"start" : ISODate("2024-08-15T23:06:13.978Z"),
"end" : ISODate("2024-08-15T23:06:13.978Z"),
"elapsedMillis" : 429,
"admin.system.roles" : {
"documentsToCopy" : 22,
"documentsCopied" : 22,
"indexes" : 2,
"fetchedBatches" : 1,
"start" : ISODate("2024-08-15T23:06:13.978Z"),
"end" : ISODate("2024-08-15T23:06:13.978Z"),
"elapsedMillis" : 138,
"receivedBatches" : 1
},
"admin.system.users" : {
"documentsToCopy" : 32,
"documentsCopied" : 32,
"indexes" : 2,
"fetchedBatches" : 1,
"start" : ISODate("2024-08-15T23:06:13.978Z"),
"end" : ISODate("2024-08-15T23:06:13.978Z"),
"elapsedMillis" : 149,
"receivedBatches" : 1
},
"admin.system.keys" : {
"documentsToCopy" : 2,
"documentsCopied" : 2,
"indexes" : 1,
"fetchedBatches" : 1,
"start" : ISODate("2024-08-15T23:06:13.978Z"),
"end" : ISODate("2024-08-15T23:06:13.978Z"),
"elapsedMillis" : 76,
"receivedBatches" : 1
},
"admin.system.version" : {
"documentsToCopy" : 2,
"documentsCopied" : 2,
"indexes" : 1,
"fetchedBatches" : 1,
"start" : ISODate("2024-08-15T23:06:13.978Z"),
"end" : ISODate("2024-08-15T23:06:13.978Z"),
"elapsedMillis" : 66,
"receivedBatches" : 1
}
},
"config" : {
"collections" : 2,
"clonedCollections" : 2,
"start" : ISODate("2024-08-15T23:06:13.978Z"),
"end" : ISODate("2024-08-15T23:06:13.978Z"),
"elapsedMillis" : 198,
"config.transactions" : {
"documentsToCopy" : 0,
"documentsCopied" : 0,
"indexes" : 1,
"fetchedBatches" : 0,
"start" : ISODate("2024-08-15T23:06:13.978Z"),
"end" : ISODate("2024-08-15T23:06:13.978Z"),
"elapsedMillis" : 74,
"receivedBatches" : 0
},
"config.system.sessions" : {
"documentsToCopy" : 0,
"documentsCopied" : 0,
"indexes" : 2,
"fetchedBatches" : 0,
"start" : ISODate("2024-08-15T23:06:13.978Z"),
"end" : ISODate("2024-08-15T23:06:13.978Z"),
"elapsedMillis" : 124,
"receivedBatches" : 0
}
},
"test" : {
"collections" : 1,
"clonedCollections" : 1,
"start" : ISODate("2024-08-15T23:06:13.978Z"),
"end" : ISODate("2024-08-15T23:06:13.978Z"),
"elapsedMillis" : 47967,
"test.hugeindex" : {
"documentsToCopy" : 25000,
"documentsCopied" : 25000,
"indexes" : 2,
"fetchedBatches" : 21,
"start" : ISODate("2024-08-15T23:06:13.978Z"),
"end" : ISODate("2024-08-15T23:06:13.978Z"),
"elapsedMillis" : 47967,
"receivedBatches" : 21
}
}
}
},
"members" : [
{
"_id" : 0,
"name" : "m1.example.net:27017",
"health" : 0,
"state" : 8,
"stateStr" : "(not reachable/healthy)",
"uptime" : 0,
"optime" : {
"ts" : Timestamp(0, 0),
"t" : Long(-1)
},
"optimeWritten" : {
"ts" : Timestamp(0, 0),
"t" : Long(-1)
},
"optimeDurable" : {
"ts" : Timestamp(0, 0),
"t" : Long(-1)
},
"optimeDate" : ISODate("1970-01-01T00:00:00Z"),
"optimeWrittenDate" : ISODate("1970-01-01T00:00:00Z"),
"optimeDurableDate" : ISODate("1970-01-01T00:00:00Z"),
"lastAppliedWallTime": ISODate("1970-01-01T00:00:00Z"),
"lastWrittenWallTime": ISODate("1970-01-01T00:00:00Z"),
"lastDurableWallTime": ISODate("1970-01-01T00:00:00Z""),
"lastHeartbeat" : ISODate("2024-08-15T23:06:13.978Z"),
"lastHeartbeatRecv" : ISODate("2024-08-15T23:06:13.978Z"),
"pingMs" : Long(0),
"lastHeartbeatMessage" : "Error connecting to m1.example.net:27017 (127.0.0.1:27018) :: caused by :: Connection refused",
"syncSourceHost" : "",
"syncSourceId" : -1,
"infoMessage" : "",
"configVersion" : 2
},
{
"_id" : 1,
"name" : "m2.example.net:27017",
"health" : 1,
"state" : 5,
"stateStr" : "STARTUP2",
"uptime" : 5297,
"optime" : {
"ts" : Timestamp(0, 0),
"t" : Long(-1)
},
"optimeWritten" : {
"ts" : Timestamp(0, 0),
"t" : Long(-1)
},
"optimeDurable" : {
"ts" : Timestamp(0, 0),
"t" : Long(-1)
},
"optimeDate" : ISODate("1970-01-01T00:00:00Z"),
"optimeWrittenDate" : ISODate("1970-01-01T00:00:00Z"),
"lastAppliedWallTime": ISODate("1970-01-01T00:00:00Z"),
"lastWrittenWallTime": ISODate("2020-03-05T05:24:38Z"),
"lastDurableWallTime": ISODate("1970-01-01T00:00:00Z"),
"syncSourceHost" : "m1.example.net:27017",
"syncSourceId" : 0,
"infoMessage" : "",
"configVersion" : 2,
"configTerm" : 1,
"self" : true,
"lastHeartbeatMessage" : ""
}
],
"ok" : 1
}

Output输出

The replSetGetStatus command returns a document with the following fields:replSetGetStatus命令返回一个包含以下字段的文档:

replSetGetStatus.set
The set value is the name of the replica set, configured in the replSetName setting. set值是在replSetName设置中配置的副本集的名称。This is the same value as _id in rs.conf().这与rs.conf()中的_id值相同。
replSetGetStatus.date
An ISODate formatted date and time that contains the current time according to the server that processed the replSetGetStatus command. 根据处理replSetGetStatus命令的服务器,包含当前时间的ISODate格式的日期和时间。Compare this to the values of replSetGetStatus.members[n].lastHeartbeat to find the operational latency between this server and the other members of the replica set.将其与replSetGetStatus.members[n].lastHeartbeat的值进行比较,以查找此服务器与副本集其他成员之间的操作延迟。
replSetGetStatus.myState
An integer between 0 and 10 that represents the replica state of the current member.一个介于010之间的整数,表示当前成员的副本状态
replSetGetStatus.term
The election count for the replica set, as known to this replica set member. The term is used by the distributed consensus algorithm to ensure correctness.此副本集成员已知的副本集的选举计数。分布式共识算法使用该任期来确保正确性。
replSetGetStatus.syncSourceHost

The syncSourceHost field holds the hostname of the member from which this instance syncs.syncSourceHost字段保存此实例从中同步的成员的主机名。

If this instance is a primary, syncSourceHost is an empty string and the syncSourceId -1.如果此实例是主实例,则syncSourceHost为空字符串,syncSourceId-1

replSetGetStatus.syncSourceId

The syncSourceId field holds the replSetGetStatus.members[n]._id of the member from which this instance synchronizes.syncSourceId字段保存此实例同步的成员的replSetGetStatus.members[n]._id

If this instance is a primary, syncSourceHost is an empty string and the syncSourceId -1.如果此实例是主实例,则syncSourceHost为空字符串,syncSourceId为-1。

replSetGetStatus.heartbeatIntervalMillis
The frequency in milliseconds of the heartbeats.心跳的频率(毫秒)。
replSetGetStatus.majorityVoteCount
The number of majority votes needed to elect a new primary in an election.在选举中选举新的初选所需的多数票数量。
replSetGetStatus.writeMajorityCount

The number of data-bearing voting members (i.e. not arbiters) needed to fulfill write concern "majority". Writes can only be applied to data-bearing members.满足写入关注"majority"所需的数据承载投票成员(即非仲裁者)的数量。写入只能应用于承载数据的成员。

For the calculation of replSetGetStatus.writeMajorityCount, see Calculating Majority for Write Concern.有关replSetGetStatus.writeMajorityCount的计算,请参阅计算写入关注的多数

replSetGetStatus.votingMembersCount
The number of members configured with votes: 1, including arbiters.配置有投票权的votes: 1,包括仲裁者。
replSetGetStatus.writableVotingMembersCount
The number of data-bearing members configured with votes: 1 (this does not include arbiters).配置了votes: 1的数据承载成员数量(不包括仲裁者)。
replSetGetStatus.optimes

The optimes field holds a document that contains optimes used to inspect replication progress. The optimes field includes the corresponding ISODate-formatted date strings for the various optimes.optimes字段包含一个文档,其中包含用于检查复制进度的optimes。optimes字段包括各种optimes的相应ISODate格式的日期字符串。

Each optime value is a document that contains:每个最优值都是一个文档,其中包含:

  • ts, the Timestamp of the operation.,操作的时间戳
  • t, the term in which the operation was originally generated on the primary.,该操作最初在主服务器上生成的任期
replSetGetStatus.optimes.lastCommittedOpTime
Information, from the viewpoint of this member, regarding the most recent operation that has been written to a majority of replica set members.从该成员的角度来看,关于已写入大多数副本集成员的最新操作的信息。
replSetGetStatus.optimes.lastCommittedWallTime
The ISODate-formatted date string corresponding to lastCommittedOpTime.对应于lastCommittedOpTime的ISODate格式的日期字符串。
replSetGetStatus.optimes.readConcernMajorityOpTime
Information, from the viewpoint of this member, regarding the most recent operation that can fulfill read concern "majority" queries; i.e. the most recent lastCommittedOpTime that can fulfill "majority" queries. 从该成员的角度来看,关于可以满足读取关注"majority"查询的最新操作的信息;即,可以满足“多数”查询的lastCommittedOpTimereadConcernMajorityOpTime is either less than or equal to lastCommittedOpTime.小于或等于lastCommittedOpTime
replSetGetStatus.optimes.readConcernMajorityWallTime
The ISODate-formatted date string corresponding to readConcernMajorityOpTime.readConcernMajorityOpTime对应的ISODate格式的日期字符串。
replSetGetStatus.optimes.appliedOpTime
Information, from the viewpoint of this member, regarding the most recent operation that has been applied to this member of the replica set.从该成员的角度来看,关于应用于副本集该成员的最新操作的信息。
replSetGetStatus.optimes.lastAppliedWallTime
The ISODate-formatted date string corresponding to appliedOpTime.appliedOpTime对应的ISODate格式的日期字符串。
replSetGetStatus.optimes.durableOpTime
Information, from the viewpoint of this member, regarding the most recent operation that has been written to the journal of this member of the replica set.从该成员的角度来看,关于已写入副本集该成员日志的最新操作的信息。
replSetGetStatus.optimes.lastDurableWallTime
The ISODate-formatted date string corresponding to durableOpTime.durableOpTime对应的ISODate格式的日期字符串。
replSetGetStatus.optimes.lastWrittenWallTime

The ISODate formatted date string of the most recent entry written to this member's oplog.写入此成员oplog的最新条目的ISODate格式的日期字符串。

New in version 8.0.在版本8.0中新增。

replSetGetStatus.optimes.writtenOpTime

The optime of the most recent entry written to this member's oplog.写入此成员oplog的最新条目的最优值。

New in version 8.0.在版本8.0中新增。

replSetGetStatus.lastStableRecoveryTimestamp
For internal use only仅限内部使用
replSetGetStatus.electionCandidateMetrics

Metrics related to the election of the current primary. electionCandidateMetrics is only available on the primary or a candidate for election. For a candidate, the metrics are unavailable after the candidate loses the election.与当前初选选举相关的指标。electionCandidateMetrics仅适用于初选或候选人。对于候选人来说,在候选人输掉选举后,这些指标是不可用的。

replSetGetStatus.electionCandidateMetrics.lastElectionReason
Reason the member called the election.该成员召集选举的原因。
replSetGetStatus.electionCandidateMetrics.lastElectionDate
The date and time the member called the election.成员宣布选举的日期和时间。
replSetGetStatus.electionCandidateMetrics.electionTerm
The member's election count (i.e. term) at the time it called the new election.该成员在举行新选举时的选举计数(即任期)。
replSetGetStatus.electionCandidateMetrics.lastCommittedOpTimeAtElection
The most recent majority-committed optime, as seen by this member, at the time it called the new election.正如这位成员所看到的,在宣布新选举时,最近的majority-committed optime
replSetGetStatus.electionCandidateMetrics.lastSeenOpTimeAtElection
The member's most recent applied optime at the time it called the new election.该成员在召集新选举时最近申请的最优解
replSetGetStatus.electionCandidateMetrics.lastSeenWrittenOpTimeAtElection

The optime of the most recent entry written to this member's oplog at the time it called the new election.这是该成员在宣布新选举时写在oplog上的最新条目的optime

New in version 8.0.在版本8.0中新增。

replSetGetStatus.electionCandidateMetrics.numVotesNeeded
The number of votes needed to win the election.赢得选举所需的票数。
replSetGetStatus.electionCandidateMetrics.priorityAtElection
The member's priority at the time it called the election.该成员在宣布选举时的priority
replSetGetStatus.electionCandidateMetrics.electionTimeoutMillis
The replica set's configured electionTimeoutMillis setting at the time of the election.副本集在选举时配置的electionTimeoutMillis设置。
replSetGetStatus.electionCandidateMetrics.priorPrimaryMemberId
The members[n]._id of the previous primary. If there is no previous primary, then the field is not present.上一次初选的members[n]._id。如果没有以前的主字段,则该字段不存在。
replSetGetStatus.electionCandidateMetrics.targetCatchupOpTime
The newly-elected primary's target opTime for its catchup process. Only when the newly-elected primary reaches the target catchup opTime can it start accepting writes.新当选的初选的目标是为追赶进程争取时间。只有当新当选的初选达到目标追赶时间时,它才能开始接受写入。
replSetGetStatus.electionCandidateMetrics.numCatchUpOps
The number of operations applied by the newly-elected primary as it successfully concludes its catchup process.新当选的初选在成功完成追赶过程时所采取的行动数量。
replSetGetStatus.electionCandidateMetrics.newTermStartDate
The date and time at which the member's term as the primary started (i.e. the date and time at which a new term entry was written to the oplog).成员作为主要成员的任期开始的日期和时间(即向oplog写入新任期条目的日期和时间)。
replSetGetStatus.electionCandidateMetrics.wMajorityWriteAvailabilityDate
The date and time at which the write concern "majority" became available after the election for the replica set (the date and time when the new term oplog entry was majority committed).在复制集选举后,写入关注的"majority"可用的日期和时间(新术语oplog条目被多数提交的日期和时候)。
replSetGetStatus.electionParticipantMetrics

Metrics related to the latest election in which the member participated.与该成员参加的最近一次选举相关的指标。

replSetGetStatus.electionParticipantMetrics.votedForCandidate
A boolean which indicates whether the member voted for the candidate calling the election.一个布尔值,表示成员是否投票支持发起选举的候选人。
replSetGetStatus.electionParticipantMetrics.electionTerm
The term of the election in which the member participated. The term identifies the election associated with the participant metrics.成员参加的选举期限。该术语标识了与参与者指标相关的选举。
replSetGetStatus.electionParticipantMetrics.lastVoteDate
An ISODate formatted date string that records when the participant voted.ISODate格式的日期字符串,记录参与者投票的时间。
replSetGetStatus.electionParticipantMetrics.electionCandidateMemberId
The members[n]._id of the candidate calling the election.宣布选举的候选人的members[n]._id
replSetGetStatus.electionParticipantMetrics.voteReason
The reason for the vote if the member did not vote for the candidate. If the member voted for the candidate, the value is an empty string.如果成员没有投票给候选人,投票的原因。如果成员投票给候选人,则值为空字符串。
replSetGetStatus.electionParticipantMetrics.lastAppliedOpTimeAtElection

This member's latest applied optime at the time of the last election.该成员在上次选举时的最新应用优化。

The optime value is a document that contains the Timestamp (ts) and the term (t).最优值是一个包含时间戳ts)和任期(t)的文档。

replSetGetStatus.electionParticipantMetrics.lastWrittenOpTimeAtElection

The optime of the most recent entry written to this member's oplog at the time of the last election.上次选举时写入该成员oplog的最新条目的optime

New in version 8.0.在版本8.0中新增。

replSetGetStatus.electionParticipantMetrics.maxAppliedOpTimeInSet
The most recent applied optime for any replica set member, as known to this member.此成员已知的任何副本集成员的最新应用最优值。
replSetGetStatus.electionParticipantMetrics.maxWrittenOpTimeInSet

The optime of the most recent entry written to the oplog of any replica set member, as known to this member.写入任何副本集成员oplog的最新条目的optime,如该成员所知。

New in version 8.0.在版本8.0中新增。

replSetGetStatus.electionParticipantMetrics.priorityAtElection
The member's priority at the time of the election.选举时成员的priority
replSetGetStatus.electionParticipantMetrics.newTermStartDate

The date and time at which the elected primary's term started; this corresponds to when the primary wrote the new term entry to its oplog and not when the entry was added (i.e. replicated) to the secondary's oplog.当选初选开始的日期和时间;这对应于小学将新学期条目写入其oplog的时间,而不是将条目添加(即复制)到中学的oplog的时候。

The field is available for secondary members only. For the primary, see replSetGetStatus.electionCandidateMetrics.newTermStartDate instead.该字段仅对次要成员可用。对于主选项,请参阅replSetGetStatus.electionCandidateMetrics.newTermStartDate

replSetGetStatus.electionParticipantMetrics.newTermAppliedDate

The date and time at which this secondary applied the new term entry.该中学应用新学期条目的日期和时间。

The field is available for secondary members only.该字段仅对次要成员可用。

replSetGetStatus.initialSyncStatus

A document that provides information on the progress and status of initial sync on this member.提供此成员初始同步进度和状态信息的文档。

Important

Availability可用性

replSetGetStatus.initialSyncStatus metrics are only available when run on a member during its initial sync (i.e. STARTUP2 state).只有在成员初始同步期间(即STARTUP2状态)在成员上运行时,指标才可用。

replSetGetStatus.initialSyncStatus.failedInitialSyncAttempts
The number of times the initial sync failed and had to restart on this member.初始同步失败并必须在此成员上重新启动的次数。
replSetGetStatus.initialSyncStatus.maxFailedInitialSyncAttempts
The maximum number of times the initial sync can restart on this member before the member shuts down.在成员关闭之前,此成员上可以重新启动初始同步的最大次数。
replSetGetStatus.initialSyncStatus.initialSyncStart
The start timestamp of the initial sync for this member.此成员的初始同步的开始时间戳。
replSetGetStatus.initialSyncStatus.initialSyncEnd
The end timestamp of the initial sync for this member.此成员的初始同步的结束时间戳。
replSetGetStatus.initialSyncStatus.initialSyncElapsedMillis
The number of milliseconds between initialSyncStart and initialSyncEnd.initialSyncStartinitialSyncEnd之间的毫秒数。
replSetGetStatus.initialSyncStatus.initialSyncAttempts

Array of documents where each document corresponds to a single initial sync attempt. For example:文档数组,其中每个文档对应一次初始同步尝试。例如:

"initialSyncAttempts" : [
{
"durationMillis" : 59539,
"status" : "InvalidOptions: error fetching oplog during initial sync :: caused by :: Error while getting the next batch in the oplog fetcher :: caused by :: readConcern afterClusterTime value must not be greater than the current clusterTime. Requested clusterTime: { ts: Timestamp(0, 1) }; current clusterTime: { ts: Timestamp(0, 0) }",
"syncSource" : "m1.example.net:27017",
"rollBackId" : 1,
"operationsRetried" : 120,
"totalTimeUnreachableMillis" : 52601
}
],

Each document contains the following information for the initial sync attempt:每个文档都包含初始同步尝试的以下信息:

Field字段Description描述
durationMillisDuration in milliseconds of the initial sync attempt.初始同步尝试的持续时间(毫秒)。
statusExit status of the initial sync attempt.初始同步尝试的退出状态。
syncSourceSync source for the initial sync attempt.初始同步尝试的同步源。
rollBackId

The sync source's rollback identifier at the start of the initial sync attempt.初始同步尝试开始时同步源的回滚标识符。

rollBackId does not appear when using file copy based initial sync.使用基于文件副本的初始同步时,不会出现rollBackId

operationsRetriedTotal number of all operation retry attempts.所有操作重试尝试的总数。
totalTimeUnreachableMillisTotal time spent for retry operation attempts.重试操作尝试所花费的总时间。

See also failedInitialSyncAttempts.

replSetGetStatus.initialSyncStatus.appliedOps

The number of ops that occurred after the initial sync started and were applied after cloning the databases.初始同步开始后发生并在克隆数据库后应用的操作数。

As part of the initial sync process, the member uses the oplog to update its data set to reflect the current state of the replica set.作为初始同步过程的一部分,成员使用oplog更新其数据集,以反映副本集的当前状态。

replSetGetStatus.initialSyncStatus.initialSyncOplogStart

The start timestamp of the oplog application stage of the initial sync where the member applies changes that occurred after the initial sync start.初始同步的oplog应用程序阶段的开始时间戳,成员在该阶段应用初始同步开始后发生的更改。

As part of the initial sync process, the member uses the oplog to update its data set to reflect the current state of the replica set.作为初始同步过程的一部分,成员使用oplog更新其数据集,以反映副本集的当前状态。

replSetGetStatus.initialSyncStatus.initialSyncOplogEnd

The end timestamp of the oplog application stage of the initial sync where the member applies changes that occurred after the initial sync start.初始同步的oplog应用程序阶段的结束时间戳,成员在该阶段应用初始同步开始后发生的更改。

As part of the initial sync process, the member uses the oplog to update its data set to reflect the current state of the replica set.作为初始同步过程的一部分,成员使用oplog更新其数据集,以反映副本集的当前状态。

replSetGetStatus.initialSyncStatus.syncSourceUnreachableSince

The date and time at which the sync source became unreachable.无法访问同步源的日期和时间。

Only present if the if sync source is unavailable during the current initial sync.仅当if同步源在当前初始同步期间不可用时才存在。

replSetGetStatus.initialSyncStatus.currentOutageDurationMillis

The time in milliseconds that the sync source has been unavailable.同步源不可用的时间(毫秒)。

Only present if the if sync source is unavailable during the current initial sync.仅当if同步源在当前初始同步期间不可用时才存在。

replSetGetStatus.initialSyncStatus.totalTimeUnreachableMillis
The total time in milliseconds that the member has been unavailable during the current initial sync.成员在当前初始同步期间不可用的总时间(毫秒)。
replSetGetStatus.initialSyncStatus.databases
Detail on the databases cloned during initial sync.初始同步期间克隆的数据库的详细信息。
replSetGetStatus.initialSyncStatus.databases.databasesCloned
Number of databases cloned during initial sync.初始同步期间克隆的数据库数。
replSetGetStatus.initialSyncStatus.databases.<dbname>

For each database, a document that returns information regarding the progress of the cloning of that database.对于每个数据库,一个文档,返回有关该数据库克隆进度的信息。

{
"collections" : <number of collections to clone in the database>,
"clonedCollections" : <number of collections cloned to date>,
"start" : <start date and time for the database clone>,
"end" : <end date and time for the database clone>,
"elapsedMillis" : <duration of the database clone>,
"<db>.<collection>" : {
"documentsToCopy" : <number of documents to copy>,
"documentsCopied" : <number of documents copied to date>,
"indexes" : <number of indexes>,
"fetchedBatches" : <number of batches of documents fetched to date>,
"start" : <start date and time for the collection clone>,
"end" : <end date and time for the collection clone>,
"elapsedMillis" : <duration of the collection clone>,
"receivedBatches" : <number of batches of documents received to date>
}
}
replSetGetStatus.initialSyncStatus.method

New in version 5.2.在版本5.2中新增。

The method used for the initial sync.用于初始同步的方法。

If set to logical, the sync is a logical initial sync. If set to fileCopyBased, the sync is a file copy based initial sync.如果设置为logical,则同步是逻辑初始同步。如果设置为fileCopyBased,则同步是基于文件副本的初始同步

replSetGetStatus.initialSyncStatus.approxTotalDataSize

The approximate size (in bytes) of all files to be synced.要同步的所有文件的大致大小(以字节为单位)。

This field appears when using either logical or file copy based initial sync.使用逻辑或基于文件副本的初始同步时,会出现此字段。

replSetGetStatus.initialSyncStatus.approxTotalBytesCopied

The total bytes already copied.已复制的总字节数。

This field appears when using either logical or file copy based initial sync.使用逻辑或基于文件副本的初始同步时,会出现此字段。

replSetGetStatus.initialSyncStatus.totalInitialSyncElapsedMillis

The total time elapsed for the sync attempt in progress.正在进行的同步尝试所用的总时间。

This field appears when using either logical or file copy based initial sync.使用逻辑或基于文件副本的初始同步时,会出现此字段。

replSetGetStatus.initialSyncStatus.remainingInitialSyncEstimatedMillis

The expected time remaining for the sync attempt in progress.正在进行的同步尝试的预期剩余时间。

This field appears when using either logical or file copy based initial sync.使用逻辑或基于文件副本的初始同步时,会出现此字段。

replSetGetStatus.initialSyncStatus.initialBackupDataSize

The total size (in bytes) of the initial set of files to be synced.要同步的初始文件集的总大小(以字节为单位)。

This field only appears when using file copy based initial sync.此字段仅在使用基于文件副本的初始同步时显示。

replSetGetStatus.initialSyncStatus.previousOplogEnd

The optime available in the previous backup cursor.上一个备份游标中可用的optime

This field only appears when using file copy based initial sync.此字段仅在使用基于文件副本的初始同步时显示。

replSetGetStatus.initialSyncStatus.currentOplogEnd

The last optime guaranteed to be available in the current backup cursor.最后一个optime保证在当前备份游标中可用。

This field only appears when using file copy based initial sync.此字段仅在使用基于文件副本的初始同步时显示。

replSetGetStatus.initialSyncStatus.syncSourceLastApplied

The optime of the last update applied at the sync source prior to the start of this backup cursor.备份游标开始之前在同步源应用的最后一次更新的optime

This field only appears when using file copy based initial sync.此字段仅在使用基于文件副本的初始同步时显示。

replSetGetStatus.initialSyncStatus.numExtensions

The number of times the sync has started a new backup cursor.同步启动新备份游标的次数。

This field does not appear if a backup cursor has not started.如果备份游标尚未启动,则不会显示此字段。

This field only appears when using file copy based initial sync.此字段仅在使用基于文件副本的初始同步时显示。

replSetGetStatus.initialSyncStatus.extensionDataSize

The total bytes in the current extension.当前扩展名中的总字节数。

This field does not appear if there is no extension in progress.如果没有正在进行的扩展,则不会显示此字段。

This field only appears when using file copy based initial sync.此字段仅在使用基于文件副本的初始同步时显示。

replSetGetStatus.initialSyncStatus.files

An array of files to be synced during file copy based initial sync.基于文件复制的初始同步期间要同步的一组文件。

This field only appears when using file copy based initial sync.此字段仅在使用基于文件副本的初始同步时显示。

replSetGetStatus.initialSyncStatus.files[n].filePath

The path of the file relative to the root of the backup cursor.文件相对于备份游标根的路径。

This field only appears when using file copy based initial sync.此字段仅在使用基于文件副本的初始同步时显示。

replSetGetStatus.initialSyncStatus.files[n].fileSize

The size of the file as reported by the backup cursor.备份游标报告的文件大小。

This field only appears when using file copy based initial sync.此字段仅在使用基于文件副本的初始同步时显示。

replSetGetStatus.initialSyncStatus.files[n].bytesCopied

The number of bytes copied so far.到目前为止复制的字节数。

This field only appears when using file copy based initial sync.此字段仅在使用基于文件副本的初始同步时显示。

replSetGetStatus.initialSyncStatus.files[n].extensionNumber

The number of the extension the file belongs to if this file is part of an extension.如果此文件是扩展名的一部分,则该文件所属的扩展名编号。

This field only appears when using file copy based initial sync.此字段仅在使用基于文件副本的初始同步时显示。

replSetGetStatus.members

The members field holds an array that contains a document for every member in the replica set.members字段包含一个数组,其中包含副本集中每个成员的文档。

replSetGetStatus.members[n]._id
The identifier for the member.成员的标识符。
replSetGetStatus.members[n].name
The name of the member.成员的姓名。
replSetGetStatus.members[n].ip
The resolved IP address of the member. If the mongod is unable to resolve the replSetGetStatus.members[n].name to an IP address, the return value is a BSON null. 成员的已解析IP地址。如果mongod无法将replSetGetStatus.members[n].name解析为IP地址,则返回值为BSON nullOtherwise, the returned value is a string representation of the resolved IP address.否则,返回的值是解析的IP地址的字符串表示。
replSetGetStatus.members[n].self

A boolean that indicates if the member is the current mongod instance.一个布尔值,指示成员是否是当前的mongod实例。

The self field is only included in the document for the current mongod instance, and as such, its value is always true.self字段仅包含在当前mongod实例的文档中,因此其值始终为true

replSetGetStatus.members[n].health
A number that indicates if the member is up (1) or down (0).一个数字,表示成员是向上(1)还是向下(0)。
replSetGetStatus.members[n].state
An integer between 0 and 10 that represents the replica state of the member.一个介于010之间的整数,表示成员的副本状态
replSetGetStatus.members[n].stateStr
A string that describes state.描述state的字符串。
replSetGetStatus.members[n].uptime

For the member on which the replSetGetStatus command is run, uptime is the the number of seconds the member has been online.对于运行replSetGetStatus命令的成员,uptime是该成员联机的秒数。

For the other members, uptime is the number of seconds the member has been in continuous communication with the member on which the replSetGetStatus command was run.对于其他成员,uptime是指该成员与运行replSetGetStatus命令的成员持续通信的秒数。

replSetGetStatus.members[n].optime

Information regarding the last operation from the operation log that this member has applied.有关此成员应用的操作日志中最后一个操作的信息。

optime returns a document that contains:返回一个包含以下内容的文档:

  • ts, the Timestamp of the last operation applied to this member of the replica set from the oplog.,从oplog中应用于副本集此成员的最后一次操作的时间戳
  • t, the term in which the last applied operation was originally generated on the primary.,最后一个应用操作最初在主服务器上生成的任期
replSetGetStatus.members[n].optimeDurable

Information regarding the last operation from the operation log that this member has applied to its journal.此成员已将操作日志中的最后一个操作应用于其日志的信息。

optimeDurable returns a document that contains:返回一个包含以下内容的文档:

  • ts, the Timestamp of the operation.,操作的时间戳
  • t, the term in which this operation was originally generated on the primary.t,此操作最初在主服务器上生成的任期
replSetGetStatus.members[n].optimeDate
An ISODate formatted date string that contains the last entry from the oplog that this member applied. ISODate格式的日期字符串,包含此成员应用的oplog中的最后一个条目。If this differs significantly from lastHeartbeat this member is either experiencing "replication lag" or there have not been any new operations after the last update. 如果这与lastHeartbeat有显著差异,则此成员正在经历“复制延迟”,或者在上次更新后没有任何新操作。Compare members.optimeDate between all of the members of the set.比较集合中所有成员之间的members.optimeDate
replSetGetStatus.members[n].optimeDurableDate
An ISODate formatted date string that contains the last entry from the oplog that this member applied to its journal.ISODate格式的日期字符串,包含此成员应用于其日记的oplog中的最后一个条目。
replSetGetStatus.members[n].lastAppliedWallTime
An ISODate formatted date string reflecting the wall clock time at which the last operation applied by this member of the replica set was applied on the primary node.ISODate格式的日期字符串,反映了此副本集成员应用的最后一个操作在主节点上应用的挂钟时间。
replSetGetStatus.members[n].lastDurableWallTime
An ISODate formatted date string reflecting the wall clock time at which the last operation written to this member's journal was first applied on the primary node.ISODate格式的日期字符串,反映了写入此成员日志的最后一个操作首次应用于主节点的挂钟时间。
replSetGetStatus.members[n].electionTime
For the current primary, information regarding the election Timestamp from the operation log. 对于当前初选,从操作日志中获取有关选举时间戳的信息。See Replica Set High Availability for more information about elections.有关选举的更多信息,请参阅副本集高可用性
replSetGetStatus.members[n].electionDate
For the current primary, an ISODate formatted date string that contains the election date. 对于当前初选,一个ISODate格式的日期字符串,其中包含选举日期。See Replica Set High Availability for more information about elections.有关选举的更多信息,请参阅副本集高可用性
replSetGetStatus.members[n].lastHeartbeat

An ISODate formatted date and time that contains the last time the server that processed the replSetGetStatus command received a response from a heartbeat that it sent to this member (members[n]). ISODate格式的日期和时间,包含处理replSetGetStatus命令的服务器最后一次收到发送给此成员(members[n])的心跳响应的时间。Compare this value to the values of the date and lastHeartbeatRecv fields to track latency between these replica set members.将此值与datelastHeartbeatRcv字段的值进行比较,以跟踪这些副本集成员之间的延迟。

This value is only available for replica set members other than the server specified by replSetGetStatus.members[n].self.此值仅适用于replSetGetStatus.members[n].self指定的服务器以外的副本集成员。

replSetGetStatus.members[n].lastHeartbeatRecv

An ISODate formatted date and time that contains the last time the server that processed the replSetGetStatus command received a heartbeat request from this member (members[n]). ISODate格式的日期和时间,包含处理replSetGetStatus命令的服务器最后一次从该成员(members[n])接收心跳请求的时间。Compare this value to the values of the date and lastHeartbeat fields to track latency between these replica set members.将此值与datelastHeartbeat字段的值进行比较,以跟踪这些副本集成员之间的延迟。

This value is only available for replica set members other than the server specified by replSetGetStatus.members[n].self.此值仅适用于replSetGetStatus.members[n].self指定的服务器以外的副本集成员。

replSetGetStatus.members[n].lastHeartbeatMessage
When the last heartbeat included an extra message, the lastHeartbeatMessage contains a string representation of that message.当最后一个心跳包含额外消息时,lastHeartbeatMessage包含该消息的字符串表示。
replSetGetStatus.members[n].pingMs

The pingMs represents the number of milliseconds (ms) that a round-trip packet takes to travel between the remote member and the local instance.pingMs表示往返数据包在远程成员和本地实例之间传输所需的毫秒数(ms)。

This value does not appear for the member that returns the rs.status() data.对于返回rs.status()数据的成员,此值不会显示。

replSetGetStatus.members[n].syncSourceHost

The syncSourceHost field holds the hostname of the member from which this instance syncs.syncSourceHost字段保存此实例从中同步的成员的主机名。

If the replSetGetStatus.members[n] is a primary, syncSourceHost is an empty string and the syncSourceId -1.如果replSetGetStatus.members[n]是主成员,则syncSourceHost是空字符串,syncSourceId-1

replSetGetStatus.members[n].syncSourceId

The syncSourceId field holds the replSetGetStatus.members[n]._id value of the syncSourceHost.syncSourceId字段保存syncSourceHostreplSetGetStatus.members[n]._id值。

If the replSetGetStatus.members[n] is a primary, syncSourceHost is an empty string and the syncSourceId -1.如果replSetGetStatus.members[n]是主成员,则syncSourceHost是空字符串,syncSourceId-1

replSetGetStatus.members[n].configVersion
The configVersion value is the replica set configuration version.configVersion值是副本集配置版本
replSetGetStatus.members[n].optimeWritten

The optime of the most recent entry written to the member's oplog.写入成员oplog的最新条目的optime

New in version 8.0.在版本8.0中新增。

replSetGetStatus.members[n].optimeWrittenDate

The ISODate formatted date string of the most recent entry written to the member's oplog.写入成员oplog的最新条目的ISODate格式的日期字符串。

New in version 8.0.在版本8.0中新增。

replSetGetStatus.members[n].lastWrittenWallTime

The ISODate formatted date string of the time when the most recent oplog entry for this member was written on the primary.ISODate格式的日期字符串,表示此成员的最新oplog条目写入主日志的时间。

New in version 8.0.在版本8.0中新增。

replSetGetStatus.tooStale
A boolean which indicates that a replica set member has fallen too far behind the primary's oplog and is stuck in the RECOVERING state. 一个布尔值,表示副本集成员远远落后于primary的oplog,并陷入RECOVERING状态。This field is only included in the replSetGetStatus output if its value is true.只有当replSetGetStatus的值为true时,此字段才会包含在replSetGetStatus输出中。

See also Response for details on the ok status field, the operationTime field and the $clusterTime field.有关ok状态字段、operationTime字段和$clusterTime字段的详细信息,请参阅响应

replSetGetStatus.optime
Present after the removal of a member from the replica set. Provides the optime of the last oplog entry applied by the removed member.从副本集中删除成员后出现。提供被删除成员应用的最后一个oplog条目的optime
replSetGetStatus.optimeDate
Present after the removal of a member from the replica set. Provides the ISODate formatted string of the optime of the last oplog entry applied by the removed member.从副本集中删除成员后出现。提供被删除成员应用的最后一个oplog条目的最优值的ISODate格式字符串。
replSetGetStatus.optimeWritten

Present after the removal of a member from the replica set. Provides the optime of the last entry written to the oplog of the removed member.从副本集中删除成员后出现。提供写入已删除成员oplog的最后一个条目的最优值。

New in version 8.0.在版本8.0中新增。

replSetGetStatus.optimeWrittenDate

Present after the removal of a member from the replica set. Provides the ISODate formatted string of the optime of the last entry written to the oplog of the removed member.从副本集中删除成员后出现。提供写入已删除成员oplog的最后一个条目的最优值的ISODate格式字符串。

New in version 8.0.在版本8.0中新增。