On this page本页内容
rs.status()
Returns the replica set status from the point of view of the member where the method is run. 从运行方法的成员的角度返回副本集状态。This method provides a wrapper around the 此方法提供replSetGetStatus command.replSetGetStatus命令的包装。
This output reflects the current status of the replica set, using data derived from the heartbeat packets sent by the other members of the replica set.此输出使用从副本集的其他成员发送的心跳数据包中导出的数据反映副本集的当前状态。
For an example and details on the output, see replSetGetStatus.有关输出的示例和详细信息,请参阅replSetGetStatus。
If you run the 如果在成员的初始同步(即mongosh helper method rs.status() (or the replSetGetStatus command) on a member during its initial sync (i.e. STARTUP2 state), the command returns replSetGetStatus.initialSyncStatus metrics.STARTUP2状态)期间对其运行mongosh助手方法rs.status()(或replSetGetStatus命令),该命令将返回replSetGetStatus.initialSyncStatus度量。
Once the member completes its initial sync, the 成员完成初始同步后,replSetGetStatus.initialSyncStatus metrics becomes unavailable.replSetGetStatus.initialSyncStatus度量将不可用。
To return initial sync status information, you must the 要返回初始同步状态信息,必须对辅助成员或replSetGetStatus command with the initialSync: 1 option on a secondary member or a member in STARTUP2 state:STARTUP2状态的成员使用replSetGetStatus命令和initialSync:1选项:
db.adminCommand( { replSetGetStatus: 1, initialSync: 1 } )
The 成员完成初始同步后,replSetGetStatus.initialSyncStatus metrics remains available after the member completes its initial sync. 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:1的replSetGetStatus命令,以返回其初始同步信息。
You cannot specify 不能将initialSync: 1 to the mongosh helper method rs.status().initialSync:1指定给mongosh助手方法rs.status()。