replSetGetStatus

On this page本页内容

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命令从处理该命令的服务器的角度返回副本集的状态。replSetGetStatus must be run against the admin database.必须针对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.由于心跳的频率,这些数据可能会过时几秒。

Syntax语法

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

db.adminCommand( { replSetGetStatus: 1 } )

Example示例

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("2020-03-05T05:24:45.567Z"),
   "myState" : 1,
   "term" : NumberLong(3),
   "syncSourceHost" : "",
   "syncSourceId" : -1,
   "heartbeatIntervalMillis" : NumberLong(2000),
   "majorityVoteCount" : 2,
   "writeMajorityCount" : 2,
   "votingMembersCount" : 3,            // Available starting in v4.4
   "writableVotingMembersCount" : 3,    // Available starting in v4.4
   "optimes" : {
      "lastCommittedOpTime" : {
         "ts" : Timestamp(1583385878, 1),
         "t" : NumberLong(3)
      },
      "lastCommittedWallTime" : ISODate("2020-03-05T05:24:38.122Z"),
      "readConcernMajorityOpTime" : {
         "ts" : Timestamp(1583385878, 1),
         "t" : NumberLong(3)
      },
      "readConcernMajorityWallTime" : ISODate("2020-03-05T05:24:38.122Z"),
      "appliedOpTime" : {
         "ts" : Timestamp(1583385878, 1),
         "t" : NumberLong(3)
      },
      "durableOpTime" : {
         "ts" : Timestamp(1583385878, 1),
         "t" : NumberLong(3)
      },
      "lastAppliedWallTime" : ISODate("2020-03-05T05:24:38.122Z"),
      "lastDurableWallTime" : ISODate("2020-03-05T05:24:38.122Z")
   },
   "lastStableRecoveryTimestamp" : Timestamp(1583385868, 2),
   "electionCandidateMetrics" : {
      "lastElectionReason" : "stepUpRequestSkipDryRun",
      "lastElectionDate" : ISODate("2020-03-05T05:24:28.061Z"),
      "electionTerm" : NumberLong(3),
      "lastCommittedOpTimeAtElection" : {
         "ts" : Timestamp(1583385864, 1),
         "t" : NumberLong(2)
      },
      "lastSeenOpTimeAtElection" : {
         "ts" : Timestamp(1583385864, 1),
         "t" : NumberLong(2)
      },
      "numVotesNeeded" : 2,
      "priorityAtElection" : 1,
      "electionTimeoutMillis" : NumberLong(10000),
      "priorPrimaryMemberId" : 1,
      "numCatchUpOps" : NumberLong(0),
      "newTermStartDate" : ISODate("2020-03-05T05:24:28.118Z"),
      "wMajorityWriteAvailabilityDate" : ISODate("2020-03-05T05:24:28.228Z")
   },
   "electionParticipantMetrics" : {
      "votedForCandidate" : true,
      "electionTerm" : NumberLong(2),
      "lastVoteDate" : ISODate("2020-03-05T05:22:33.306Z"),
      "electionCandidateMemberId" : 1,
      "voteReason" : "",
      "lastAppliedOpTimeAtElection" : {
         "ts" : Timestamp(1583385748, 1),
         "t" : NumberLong(1)
      },
      "maxAppliedOpTimeInSet" : {
         "ts" : Timestamp(1583385748, 1),
         "t" : NumberLong(1)
      },
      "priorityAtElection" : 1
   },
   "members" : [
      {
         "_id" : 0,
         "name" : "m1.example.net:27017",
         "health" : 1,
         "state" : 1,
         "stateStr" : "PRIMARY",
         "uptime" : 269,
         "optime" : {
            "ts" : Timestamp(1583385878, 1),
            "t" : NumberLong(3)
         },
         "optimeDate" : ISODate("2020-03-05T05:24:38Z"),
         "lastAppliedWallTime": ISODate("2020-03-05T05:24:38Z"),
         "lastDurableWallTime": ISODate("2020-03-05T05:24:38Z"),
         "syncSourceHost" : "",
         "syncSourceId" : -1,
         "infoMessage" : "",
         "electionTime" : Timestamp(1583385868, 1),
         "electionDate" : ISODate("2020-03-05T05:24:28Z"),
         "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(1583385878, 1),
            "t" : NumberLong(3)
         },
         "optimeDurable" : {
            "ts" : Timestamp(1583385878, 1),
            "t" : NumberLong(3)
         },
         "optimeDate" : ISODate("2020-03-05T05:24:38Z"),
         "optimeDurableDate" : ISODate("2020-03-05T05:24:38Z"),
         "lastAppliedWallTime": ISODate("2020-03-05T05:24:38Z"),
         "lastDurableWallTime": ISODate("2020-03-05T05:24:38Z"),
         "lastHeartbeat" : ISODate("2020-03-05T05:24:44.114Z"),
         "lastHeartbeatRecv" : ISODate("2020-03-05T05:24:43.999Z"),
         "pingMs" : NumberLong(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(1583385878, 1),
            "t" : NumberLong(3)
         },
         "optimeDurable" : {
            "ts" : Timestamp(1583385878, 1),
            "t" : NumberLong(3)
         },
         "optimeDate" : ISODate("2020-03-05T05:24:38Z"),
         "optimeDurableDate" : ISODate("2020-03-05T05:24:38Z"),
         "lastAppliedWallTime": ISODate("2020-03-05T05:24:38Z"),
         "lastDurableWallTime": ISODate("2020-03-05T05:24:38Z"),
         "lastHeartbeat" : ISODate("2020-03-05T05:24:44.114Z"),
         "lastHeartbeatRecv" : ISODate("2020-03-05T05:24:43.998Z"),
         "pingMs" : NumberLong(0),
         "lastHeartbeatMessage" : "",
         "syncSourceHost" : "m1.example.net:27017",
         "syncSourceId" : 0,
         "infoMessage" : "",
         "configVersion" : 1
      }
   ],
   "ok" : 1,
   "$clusterTime" : {
      "clusterTime" : Timestamp(1583385878, 1),
      "signature" : {
         "hash" : BinData(0,"9C2qcGVkipEGJW3iF90qxb/gIwc="),
         "keyId" : NumberLong("6800589497806356482")
      }
   },
   "operationTime" : Timestamp(1583385878, 1)
}

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("2020-03-05T05:27:06.939Z"),
   "myState" : 2,
   "term" : NumberLong(3),
   "syncSourceHost" : "m3.example.net:27017",
   "syncSourceId" : 2,
   "heartbeatIntervalMillis" : NumberLong(2000),
   "majorityVoteCount" : 2,
   "writeMajorityCount" : 2,
   "votingMembersCount" : 3,             // Available starting in v4.4
   "writableVotingMembersCount" : 3,     // Available starting in v4.4
   "optimes" : {
      "lastCommittedOpTime" : {
         "ts" : Timestamp(1583386018, 1),
         "t" : NumberLong(3)
      },
      "lastCommittedWallTime" : ISODate("2020-03-05T05:26:58.175Z"),
      "readConcernMajorityOpTime" : {
         "ts" : Timestamp(1583386018, 1),
         "t" : NumberLong(3)
      },
      "readConcernMajorityWallTime" : ISODate("2020-03-05T05:26:58.175Z"),
      "appliedOpTime" : {
         "ts" : Timestamp(1583386018, 1),
         "t" : NumberLong(3)
      },
      "durableOpTime" : {
         "ts" : Timestamp(1583386018, 1),
         "t" : NumberLong(3)
      },
      "lastAppliedWallTime" : ISODate("2020-03-05T05:26:58.175Z"),
      "lastDurableWallTime" : ISODate("2020-03-05T05:26:58.175Z")
   },
   "lastStableRecoveryTimestamp" : Timestamp(1583385988, 1),
   "electionParticipantMetrics" : {
      "votedForCandidate" : true,
      "electionTerm" : NumberLong(3),
      "lastVoteDate" : ISODate("2020-03-05T05:24:28.076Z"),
      "electionCandidateMemberId" : 0,
      "voteReason" : "",
      "lastAppliedOpTimeAtElection" : {
         "ts" : Timestamp(1583385864, 1),
         "t" : NumberLong(2)
      },
      "maxAppliedOpTimeInSet" : {
         "ts" : Timestamp(1583385864, 1),
         "t" : NumberLong(2)
      },
      "priorityAtElection" : 1,
      "newTermStartDate" : ISODate("2020-03-05T05:24:28.118Z"),
      "newTermAppliedDate" : ISODate("2020-03-05T05:24:29.739Z")
   },
   "members" : [
      {
         "_id" : 0,
         "name" : "m1.example.net:27017",
         "health" : 1,
         "state" : 1,
         "stateStr" : "PRIMARY",
         "uptime" : 407,
         "optime" : {
            "ts" : Timestamp(1583386018, 1),
            "t" : NumberLong(3)
         },
         "optimeDurable" : {
            "ts" : Timestamp(1583386018, 1),
            "t" : NumberLong(3)
         },
         "optimeDate" : ISODate("2020-03-05T05:26:58Z"),
         "optimeDurableDate" : ISODate("2020-03-05T05:26:58Z"),
         "lastAppliedWallTime": ISODate("2020-03-05T05:26:58Z"),
         "lastDurableWallTime": ISODate("2020-03-05T05:26:58Z"),
         "lastHeartbeat" : ISODate("2020-03-05T05:27:06.165Z"),
         "lastHeartbeatRecv" : ISODate("2020-03-05T05:27:06.329Z"),
         "pingMs" : NumberLong(0),
         "lastHeartbeatMessage" : "",
         "syncSourceHost" : "",
         "syncSourceId" : -1,
         "infoMessage" : "",
         "electionTime" : Timestamp(1583385868, 1),
         "electionDate" : ISODate("2020-03-05T05:24:28Z"),
         "configVersion" : 1
      },
      {
         "_id" : 1,
         "name" : "m2.example.net:27017",
         "health" : 1,
         "state" : 2,
         "stateStr" : "SECONDARY",
         "uptime" : 409,
         "optime" : {
            "ts" : Timestamp(1583386018, 1),
            "t" : NumberLong(3)
         },
         "optimeDate" : ISODate("2020-03-05T05:26:58Z"),
         "lastAppliedWallTime": ISODate("2020-03-05T05:26:58Z"),
         "lastDurableWallTime": ISODate("2020-03-05T05:26:58Z"),
         "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(1583386018, 1),
            "t" : NumberLong(3)
         },
         "optimeDurable" : {
            "ts" : Timestamp(1583386018, 1),
            "t" : NumberLong(3)
         },
         "optimeDate" : ISODate("2020-03-05T05:26:58Z"),
         "optimeDurableDate" : ISODate("2020-03-05T05:26:58Z"),
         "lastAppliedWallTime": ISODate("2020-03-05T05:26:58Z"),
         "lastDurableWallTime": ISODate("2020-03-05T05:26:58Z"),
         "lastHeartbeat" : ISODate("2020-03-05T05:27:06.165Z"),
         "lastHeartbeatRecv" : ISODate("2020-03-05T05:27:06.165Z"),
         "pingMs" : NumberLong(0),
         "lastHeartbeatMessage" : "",
         "syncSourceHost" : "m1.example.net:27017",
         "syncSourceId" : 0,
         "infoMessage" : "",
         "configVersion" : 1
      }
   ],
   "ok" : 1,
   "$clusterTime" : {
      "clusterTime" : Timestamp(1583386018, 1),
      "signature" : {
         "hash" : BinData(0,"kmhE5YARZlzn/DX4B/D0E5P6okY="),
         "keyId" : NumberLong("6800589497806356482")
      }
   },
   "operationTime" : Timestamp(1583386018, 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 } )
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文档包含其他字段
Starting in MongoDB 4.2.1,从MongoDB 4.2.1开始,

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

db.adminCommand( { replSetGetStatus: 1 } )

Once the member finishes its initial sync and transitions to another state, the replSetGetStatus.initialSyncStatus document is no longer available.一旦成员完成初始同步并转换到另一个状态,replSetGetStatus.initialSyncStatus文档将不再可用。

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 } )

For 3.6.x-4.2.0 replica sets, replSetGetStatus.initialSyncStatus metrics remains available after the member completes its initial sync. 对于3.6x-4.2.0副本集,在成员完成初始同步后,replSetGetStatus.initialSyncStatus度量仍然可用。That is, you can run the replSetGetStatus command with the initialSync: 1 on the secondary member to return its initial sync information.也就是说,可以在辅助成员上运行带有initialSync:1replSetGetStatus命令,以返回其初始同步信息。

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("2020-03-05T18:04:24.274Z"),
   "myState" : 5,
   "term" : NumberLong(1),
   "syncSourceHost" : "m1.example.net:27017",
   "syncSourceId" : 0,
   "heartbeatIntervalMillis" : NumberLong(2000),
   "majorityVoteCount" : 2,
   "writeMajorityCount" : 2,
   "votingMembersCount" : 2,                 // Available starting in v4.4
   "writableVotingMembersCount" : 2,         // Available starting in v4.4
   "optimes" : {
      "lastCommittedOpTime" : {
         "ts" : Timestamp(0, 0),
         "t" : NumberLong(-1)
      },
      "lastCommittedWallTime" : ISODate("1970-01-01T00:00:00Z"),
      "appliedOpTime" : {
         "ts" : Timestamp(0, 0),
         "t" : NumberLong(-1)
      },
      "durableOpTime" : {
         "ts" : Timestamp(0, 0),
         "t" : NumberLong(-1)
      },
      "lastAppliedWallTime" : ISODate("1970-01-01T00:00:00Z"),
      "lastDurableWallTime" : ISODate("1970-01-01T00:00:00Z")
   },
   "lastStableRecoveryTimestamp" : Timestamp(0, 0),
   "initialSyncStatus" : {
      "failedInitialSyncAttempts" : 0,
      "maxFailedInitialSyncAttempts" : 10,
      "initialSyncStart" : ISODate("2020-03-05T18:03:33.248Z"),
      "initialSyncAttempts" : [ ],
      "appliedOps" : 0,
      "initialSyncOplogStart" : Timestamp(1583431411, 1),
      "syncSourceUnreachableSince" : ISODate("2020-03-05T18:04:15.587Z"),  // Available starting in v4.4
      "currentOutageDurationMillis" : NumberLong(8687),                    // Available starting in v4.4
      "totalTimeUnreachableMillis" : NumberLong(8687),                     // Available starting in v4.4
      "databases" : {
         "databasesCloned" : 3,
         "admin" : {
            "collections" : 4,
            "clonedCollections" : 4,
            "start" : ISODate("2020-03-05T18:03:33.490Z"),
            "end" : ISODate("2020-03-05T18:03:33.919Z"),
            "elapsedMillis" : 429,
            "admin.system.roles" : {
               "documentsToCopy" : 22,
               "documentsCopied" : 22,
               "indexes" : 2,
               "fetchedBatches" : 1,
               "start" : ISODate("2020-03-05T18:03:33.490Z"),
               "end" : ISODate("2020-03-05T18:03:33.628Z"),
               "elapsedMillis" : 138,
               "receivedBatches" : 1
            },
            "admin.system.users" : {
               "documentsToCopy" : 32,
               "documentsCopied" : 32,
               "indexes" : 2,
               "fetchedBatches" : 1,
               "start" : ISODate("2020-03-05T18:03:33.628Z"),
               "end" : ISODate("2020-03-05T18:03:33.777Z"),
               "elapsedMillis" : 149,
               "receivedBatches" : 1
            },
            "admin.system.keys" : {
               "documentsToCopy" : 2,
               "documentsCopied" : 2,
               "indexes" : 1,
               "fetchedBatches" : 1,
               "start" : ISODate("2020-03-05T18:03:33.777Z"),
               "end" : ISODate("2020-03-05T18:03:33.853Z"),
               "elapsedMillis" : 76,
               "receivedBatches" : 1
            },
            "admin.system.version" : {
               "documentsToCopy" : 2,
               "documentsCopied" : 2,
               "indexes" : 1,
               "fetchedBatches" : 1,
               "start" : ISODate("2020-03-05T18:03:33.853Z"),
               "end" : ISODate("2020-03-05T18:03:33.919Z"),
               "elapsedMillis" : 66,
               "receivedBatches" : 1
            }
         },
         "config" : {
            "collections" : 2,
            "clonedCollections" : 2,
            "start" : ISODate("2020-03-05T18:03:33.929Z"),
            "end" : ISODate("2020-03-05T18:03:34.127Z"),
            "elapsedMillis" : 198,
            "config.transactions" : {
               "documentsToCopy" : 0,
               "documentsCopied" : 0,
               "indexes" : 1,
               "fetchedBatches" : 0,
               "start" : ISODate("2020-03-05T18:03:33.929Z"),
               "end" : ISODate("2020-03-05T18:03:34.003Z"),
               "elapsedMillis" : 74,
               "receivedBatches" : 0
            },
            "config.system.sessions" : {
               "documentsToCopy" : 0,
               "documentsCopied" : 0,
               "indexes" : 2,
               "fetchedBatches" : 0,
               "start" : ISODate("2020-03-05T18:03:34.003Z"),
               "end" : ISODate("2020-03-05T18:03:34.127Z"),
               "elapsedMillis" : 124,
               "receivedBatches" : 0
            }
         },
         "test" : {
            "collections" : 1,
            "clonedCollections" : 1,
            "start" : ISODate("2020-03-05T18:03:34.127Z"),
            "end" : ISODate("2020-03-05T18:04:22.094Z"),
            "elapsedMillis" : 47967,
            "test.hugeindex" : {
               "documentsToCopy" : 25000,
               "documentsCopied" : 25000,
               "indexes" : 2,
               "fetchedBatches" : 21,
               "start" : ISODate("2020-03-05T18:03:34.127Z"),
               "end" : ISODate("2020-03-05T18:04:22.094Z"),
               "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" : NumberLong(-1)
         },
         "optimeDurable" : {
            "ts" : Timestamp(0, 0),
            "t" : NumberLong(-1)
         },
         "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
         "optimeDurableDate" : ISODate("1970-01-01T00:00:00Z"),
         "lastAppliedWallTime": ISODate("1970-01-01T00:00:00Z"),
         "lastDurableWallTime": ISODate("1970-01-01T00:00:00Z""),
         " lastHeartbeat" : ISODate("2020-03-05T18:04:23. 827Z"),
         " lastHeartbeatRecv" : ISODate("2020-03-05T18:04:15. 062Z"),
         " pingMs" : NumberLong(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" : NumberLong(-1)
         },
         " optimeDate" : ISODate("1970-01-01T00:00:00Z"),
         " lastAppliedWallTime": ISODate("1970-01-01T00:00:00Z"),
         " 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 reflects the current time according to the server that processed the replSetGetStatus command. ISODate格式的日期和时间,根据处理replSetGetStatus命令的服务器反映当前时间。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.分布式共识算法使用该term来确保正确性。

replSetGetStatus.syncingTo

Removed in MongoDB 4.4在MongoDB 4.4中删除

See replSetGetStatus.syncSourceHost instead.请参阅replSetGetStatus.syncSourceHost

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为空字符串,syncSourceId1

replSetGetStatus.syncSourceId

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

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

replSetGetStatus.heartbeatIntervalMillis

The frequency in milliseconds of the heartbeats.心跳的频率(毫秒)。

replSetGetStatus.majorityVoteCount

New in version 4.2.1.在版本4.2.1中新增

The number that corresponds to the majority votes needed to elect a new primary in an election.在选举中选出新初选所需的多数票所对应的数字。

replSetGetStatus.writeMajorityCount

New in version 4.2.1.在版本4.2.1中新增

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

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

replSetGetStatus.votingMembersCount

New in version 4.4.在版本4.4中新增

The number of members configured with votes: 1, including arbiters.配置有投票的votes: 1,包括仲裁器。

replSetGetStatus.writableVotingMembersCount

New in version 4.4.在版本4.4中新增

The number of data-bearing members configured with votes: 1; that is, the count does not include arbiters.配置有votes: 1数据承载成员的数量;也就是说,计数不包括仲裁器。

replSetGetStatus.optimes

The optimes field holds a document that contains optimes used to inspect replication progress. optics字段包含一个文档,其中包含用于检查复制进度的optics。Starting in MongoDB 4.2, the optimes include the corresponding ISODate-formatted date strings for the various optimes.从MongoDB 4.2开始,optims包含各种optims对应的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.t,最初在主计算机上生成操作的term
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格式的日期字符串。

The lastCommittedWallTime may not accurately reflect lastCommittedOpTime if all members are not on MongoDB 4.2 or greater since the lastCommittedWallTime requires communication with other members of the deployment.如果所有成员都不在MongoDB 4.2或更高版本上,则lastCommittedWallTime可能无法准确反映lastCommittedOpTime,因为lastCommittedWallTime需要与部署的其他成员进行通信。

New in version 4.2.在版本4.2中新增

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"查询的最近操作的信息;即,可以完成"majority"查询的最新lastCommittedOpTimereadConcernMajorityOpTime is either less than or equal to lastCommittedOpTime.小于或等于lastCommittedOpTime

replSetGetStatus.optimes.readConcernMajorityWallTime

The ISODate-formatted date string corresponding to readConcernMajorityOpTime.readConcernMajorityOpTime对应的ISODate格式的日期字符串。

The readConcernMajorityWallTime may not accurately reflect readConcernMajorityOpTime if all members are not on MongoDB 4.2 or greater since the readConcernMajorityWallTime requires communication with other members of the deployment.如果所有成员都不在MongoDB 4.2或更高版本上,readConcernMajorityWallTime可能无法准确反映readConcernMajorityOpTime,因为readConcernMajorityWallTime需要与部署的其他成员进行通信。

New in version 4.2.在版本4.2中新增

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格式的日期字符串。

New in version 4.2.在版本4.2中新增

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格式的日期字符串。

New in version 4.2.在版本4.2中新增

replSetGetStatus.lastStableCheckpointTimestamp

Deprecated since version 4.2.自4.2版起已弃用。

Available for the WiredTiger Storage Engine.适用于WiredTiger存储引擎

Timestamp at which the current, or a previous, persisted checkpoint was taken. 获取当前或上一个持久化检查点的时间戳。Although lastStableCheckpointTimestamp may lag the most recent persisted checkpoint, the returned timestamp is guaranteed to be persisted in a stable checkpoint to disk.尽管lastStableCheckpointTimestamp可能会滞后于最近的持久化检查点,但返回的时间戳保证会持久化在磁盘的稳定检查点中。

A null value indicates that no stable checkpoint exists.null值表示不存在稳定的检查点。

replSetGetStatus.lastStableRecoveryTimestamp

New in version 4.2.在版本4.2中新增

For internal use only仅供内部使用

replSetGetStatus.electionCandidateMetrics

New in version 4.2.1.在版本4.2.1中新增

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 becomes unavailable once the candidate loses the election.对于候选人,一旦候选人落选,指标就变得不可用。

replSetGetStatus.electionCandidateMetrics.lastElectionReason

New in version 4.2.1.在版本4.2.1中新增

Reason the member called the election.成员召集选举的原因。

replSetGetStatus.electionCandidateMetrics.lastElectionDate

New in version 4.2.1.在版本4.2.1中新增

The date and time the member called the election.成员召集选举的日期和时间。

replSetGetStatus.electionCandidateMetrics.electionTerm

Changed in version 4.2.2.在版本4.2.2中更改

In v4.2.1, electionTerm was named electionTerm.在v4.2.1中,electionTerm被命名为electionTerm

The member's election count (i.e. term) at the time it called for the new election.该成员要求进行新选举时的选举计数(即term)。

replSetGetStatus.electionCandidateMetrics.lastCommittedOpTimeAtElection

New in version 4.2.1.在版本4.2.1中新增

The most recent majority-committed optime, as seen by this member, at the time it called for the new election.正如这位成员所见,最近的majority-committed optime在呼吁新一届选举时承诺了最优。

replSetGetStatus.electionCandidateMetrics.lastSeenOpTimeAtElection

New in version 4.2.1.在版本4.2.1中新增

The member's most recent applied optime at the time it called for the new election.该成员在要求举行新的选举时最新applied optime

replSetGetStatus.electionCandidateMetrics.numVotesNeeded

New in version 4.2.1.在版本4.2.1中新增

The number of votes needed to win the election.赢得选举所需的票数。

replSetGetStatus.electionCandidateMetrics.priorityAtElection

New in version 4.2.1.在版本4.2.1中新增

The member's priority at the time it called the election.该成员在举行选举时的priority

replSetGetStatus.electionCandidateMetrics.electionTimeoutMillis

New in version 4.2.1.在版本4.2.1中新增

The replica set's configured electionTimeoutMillis setting at the time of the election.副本集在选择时配置的electionTimeoutMillis设置。

replSetGetStatus.electionCandidateMetrics.priorPrimaryMemberId

New in version 4.2.1.在版本4.2.1中新增

The members[n]._id of the previous primary. 上一个primary的members[n]._idIf there is no previous primary, then the field is not present.如果没有以前的主字段,则该字段不存在。

replSetGetStatus.electionCandidateMetrics.targetCatchupOpTime

New in version 4.2.1.在版本4.2.1中新增

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.只有当新当选的主节点达到目标追赶opTime时,它才能开始接受写入。

replSetGetStatus.electionCandidateMetrics.numCatchUpOps

New in version 4.2.1.在版本4.2.1中新增

The number of operations applied by the newly-elected primary as it successfully concludes its catchup process.新当选的初选在成功结束追赶过程时应用的操作数。

replSetGetStatus.electionCandidateMetrics.newTermStartDate

New in version 4.2.1.在版本4.2.1中新增

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).成员作为主要成员的任期开始的日期和时间(即new term条目写入oplog的日期和日期)。

replSetGetStatus.electionCandidateMetrics.wMajorityWriteAvailabilityDate

New in version 4.2.1.在版本4.2.1中新增

The date and time at which the write concern "majority" became available after the election for the replica set(i.e. the date and time at which the new term oplog entry was majority committed).选择副本集后,写入关注点"majority"变为可用的日期和时间(即提交new termoplog条目的日期和日期)。

replSetGetStatus.electionParticipantMetrics

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

New in version 4.2.2.在版本4.2.2中新增

replSetGetStatus.electionParticipantMetrics.votedForCandidate

A boolean which indicates whether the member voted for the candidate calling the election.一个布尔值,指示成员是否投票给发起选举的候选人。

New in version 4.2.2.在版本4.2.2中新增

replSetGetStatus.electionParticipantMetrics.electionTerm

The term of the election in which the member participated. 该成员参加的选举的任期。The term identifies the election associated with the participant metrics.该术语标识与参与者度量相关联的选举。

New in version 4.2.2.在版本4.2.2中新增

replSetGetStatus.electionParticipantMetrics.lastVoteDate

An ISODate formatted date string that reflects when the participant voted.反映参与者投票时间的ISODate格式的日期字符串。

New in version 4.2.2.在版本4.2.2中新增

replSetGetStatus.electionParticipantMetrics.electionCandidateMemberId

The members[n]._id of the candidate calling the election.召集选举的候选人的members[n]._id

New in version 4.2.2.在版本4.2.2中新增

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.如果成员投票给候选人,则该值为空字符串。

New in version 4.2.2.在版本4.2.2中新增

replSetGetStatus.electionParticipantMetrics.lastAppliedOpTimeAtElection

This member's latest applied optime at the time of the election.这名成员在选举时最新采用的最佳方案。

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

replSetGetStatus.electionParticipantMetrics.maxAppliedOpTimeInSet

The most recent applied optime for any member of this replica set, as known by this member.此复制集的任何成员的最新应用优化,如该成员所知。

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

New in version 4.2.2.在版本4.2.2中新增

replSetGetStatus.electionParticipantMetrics.priorityAtElection

The member's priority at the time of the election.成员在选举时的priority

New in version 4.2.2.在版本4.2.2中新增

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.当选总统任期开始的日期和时间;这对应于主设备将new term条目写入其oplog的时间,而不是将条目添加(即复制)到辅助设备的oplog的时候。

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

New in version 4.2.2.在版本4.2.2中新增

replSetGetStatus.electionParticipantMetrics.newTermAppliedDate

The date and time at which this secondary applied the new term entry.此辅助应用new term条目的日期和时间。

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

New in version 4.2.2.在版本4.2.2中新增

replSetGetStatus.initialSyncStatus

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

Important重要
Availability可利用性

Starting in MongoDB 4.2.1, replSetGetStatus.initialSyncStatus metrics are only available when run on a member during its initial sync (i.e. STARTUP2 state).从MongoDB 4.2.1开始,replSetGetStatus.initialSyncStatus度量仅在成员初始同步期间(即STARTUP2状态)运行时可用。

In earlier versions (3.6.x-4.2.0), replSetGetStatus.initialSyncStatus metrics are available when the command is run with initialSync: 1 option on a secondary or a member in its STARTUP2 state, even after the member completes its initial sync. 在早期版本(3.6x-4.2.0)中,当命令在辅助或处于STARTUP2状态的成员上使用initialSync:1选项运行时,即使在该成员完成初始同步后,replSetGetStatus.initialSyncStatus度量也可用。However, some fields that relate to the progress of an on-going initial sync only appear while the initial sync is in progress and do not appear once the initial sync completes.然而,一些与正在进行的初始同步的进度相关的字段仅在初始同步进行时出现,而在初始同步完成后不会出现。

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,
                     // Available starting in v4.4
      "operationsRetried" : 120,
            // Available starting in v4.4
      "totalTimeUnreachableMillis" : 52601  // Available starting in v4.4
   }
],

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

New in version 4.4.在版本4.4中新增

operationsRetried

Total number of all operation retry attempts.所有操作重试尝试的总数。

New in version 4.4.在版本4.4中新增

totalTimeUnreachableMillis

Total time spent for retry operation attempts.重试操作尝试花费的总时间。

New in version 4.4.在版本4.4中新增

See also failedInitialSyncAttempts.另请参阅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同步源在当前初始同步期间不可用时出现。

New in version 4.4.在版本4.4中新增

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同步源在当前初始同步期间不可用时出现。

New in version 4.4.在版本4.4中新增

replSetGetStatus.initialSyncStatus.totalTimeUnreachableMillis

The total time in milliseconds that the member has been unavailable during the current initial sync.当前初始同步期间成员不可用的总时间(毫秒)。

New in version 4.4.在版本4.4中新增

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>  // Added in 4.2
   }
}
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. 如果设置为logical,则同步为逻辑初始同步If set to fileCopyBased, the sync is a file copy based initial sync.如果设置为fileCopyBased,则同步是基于文件副本的初始同步

replSetGetStatus.initialSyncStatus.approxTotalDataSize

The approximate size (in bytes) of all files to be synced during file copy based initial sync.基于文件副本的初始同步期间要同步的所有文件的大致大小(以字节为单位)。

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

replSetGetStatus.initialSyncStatus.approxTotalBytesCopied

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

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

replSetGetStatus.initialSyncStatus.totalInitialSyncElapsedMillis

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

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

replSetGetStatus.initialSyncStatus.remainingInitialSyncEstimatedMillis

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

This field only appears when using 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. 成员的已解析IP地址。If the mongod is unable to resolve the replSetGetStatus.members[n].name to an IP address, the return value is a BSON null. 如果mongod无法将replSetGetStatus.members[n].name解析为IP地址,则返回值为BSON nullOtherwise, the returned value is a string representation of the resolved IP address.否则,返回的值是解析IP地址的字符串表示。

New in version 4.2.在版本4.2中新增

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 (i.e. 1) or down (i.e. 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

The uptime field holds a value that reflects the number of seconds that this member has been online.uptime字段包含一个值,该值反映该成员已联机的秒数。

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

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.,上次应用的操作最初在主计算机上生成的term
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.,最初在主计算机上生成此操作的term
replSetGetStatus.members[n].optimeDate

An ISODate formatted date string that reflects 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 since 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 reflects 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 reflects 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 reflects 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.将此值与datelastHeartbeatRecv字段的值进行比较,以跟踪这些副本集成员之间的延迟。

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 reflects 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].syncingTo

Removed in MongoDB 4.4在MongoDB 4.4中删除

See replSetGetStatus.members[n].syncSourceHost instead.请参阅replSetGetStatus.members[n].syncSourceHost

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]是primary,则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.如果rreplSetGetStatus.members[n]是primary,则syncSourceHost为空字符串,syncSourceId-1

replSetGetStatus.members[n].configVersion

The configVersion value is the replica set configuration version.configVersion值是副本集配置版本

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的操作日志太多,并且处于RECOVERING状态。This field is only included in the replSetGetStatus output if its value is true.只有当replSetGetStatus输出的值为true时,该字段才包含在其中。

New in version 4.4.在版本4.4中新增

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

←  replSetGetConfigreplSetInitiate →