How to check secondary is synced now or not

后端 未结 4 646
深忆病人
深忆病人 2021-02-01 04:12

there is the replica with three member (primary,secondary,secondary). Suppose one of secondaries down for a day, after return secondary back to replica how can i find, i

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-01 04:41

    Update 13th February 2017

    Agree with the accepted answer that rs.status() offers adequate information and is an easy command to remember. However, (personally using Mongo 3 now), do also really like the convenience and readability of rs.printSlaveReplicationInfo().

    It gives an output something like:

    rs.printSlaveReplicationInfo()
    
    source: node-2:27017
        syncedTo: Mon Feb 13 2017 06:15:17 GMT-0500 (EST)
        0 secs (0 hrs) behind the primary
    source: node-3:27017
        syncedTo: Mon Feb 13 2017 06:15:16 GMT-0500 (EST)
        1 secs (0 hrs) behind the primary
    

    As you can see, it is easy to get a sense of whether the synchronization between the nodes in the replica set is healthy or not.

提交回复
热议问题