0

我对主服务器执行包含大量数据的写入操作。如何测量从主服务器上的数据到辅助服务器的时间。

4

1 回答 1

2

来自https://docs.mongodb.com/manual/tutorial/troubleshoot-replica-sets/#check-the-replication-lag

检查当前复制延迟的长度:

在连接到主的 mongo shell 中,调用 rs.printSlaveReplicationInfo() 方法。

返回每个成员的 syncedTo 值,该值显示最后一个 oplog 条目写入辅助节点的时间,如下例所示:

source: m1.example.net:27017
    syncedTo: Thu Apr 10 2014 10:27:47 GMT-0400 (EDT)
    0 secs (0 hrs) behind the primary
source: m2.example.net:27017
    syncedTo: Thu Apr 10 2014 10:27:47 GMT-0400 (EDT)
    0 secs (0 hrs) behind the primary
于 2019-02-20T09:54:25.157 回答