如何知道副本集初始同步完成的时间

时间:2015-03-18 10:08:48

标签: mongodb

来自MongoDB文档:

  

此时,mongod将执行初始同步。初始同步过程的长度取决于数据库的大小和副本集成员之间的网络连接。

Source

我的问题非常简单,我怎么知道stepDown我的副本集的PRIMARY成员何时安全?我刚刚升级了我的二级使用WiredTiger。

rs.status()的输出:

{
    "set" : "m0",
    "date" : ISODate("2015-03-18T09:59:21.486Z"),
    "myState" : 1,
    "members" : [
        {
            "_id" : 0,
            "name" : "example.com",
            "health" : 1,
            "state" : 1,
            "stateStr" : "PRIMARY",
            "uptime" : 4642,
            "optime" : Timestamp(1426672500, 1),
            "optimeDate" : ISODate("2015-03-18T09:55:00Z"),
            "electionTime" : Timestamp(1426668268, 1),
            "electionDate" : ISODate("2015-03-18T08:44:28Z"),
            "configVersion" : 7,
            "self" : true
        },
        {
            "_id" : 1,
            "name" : "example.com"",
            "health" : 1,
            "state" : 2,
            "stateStr" : "SECONDARY",
            "uptime" : 1309,
            "optime" : Timestamp(1426672500, 1),
            "optimeDate" : ISODate("2015-03-18T09:55:00Z"),
            "lastHeartbeat" : ISODate("2015-03-18T09:59:20.968Z"),
            "lastHeartbeatRecv" : ISODate("2015-03-18T09:59:20.762Z"),
            "pingMs" : 0,
            "syncingTo" : "example.com"",
            "configVersion" : 7
        },
        {
            "_id" : 2,
            "name" : "example.com"",
            "health" : 1,
            "state" : 7,
            "stateStr" : "ARBITER",
            "uptime" : 4640,
            "lastHeartbeat" : ISODate("2015-03-18T09:59:21.009Z"),
            "lastHeartbeatRecv" : ISODate("2015-03-18T09:59:21.238Z"),
            "pingMs" : 59,
            "configVersion" : 7
        }
    ],
    "ok" : 1
}

1 个答案:

答案 0 :(得分:0)

找到解决方案:

执行初始同步时,状态为RECOVERING