初始化mongodb副本集永远不会完成

时间:2015-04-27 14:13:51

标签: mongodb

我正在尝试初始化一个mongodb副本集,但每当我添加新节点时,它永远不会超过状态3(RECOVERING)。以下是rs.status()的快照:

rs0:OTHER> rs.status()
{
    "set" : "rs0",
    "date" : ISODate("2015-04-27T14:09:21.973Z"),
    "myState" : 3,
    "members" : [
        {
            "_id" : 0,
            "name" : "10.0.1.184:27017",
            "health" : 1,
            "state" : 1,
            "stateStr" : "PRIMARY",
            "uptime" : 6899,
            "optime" : Timestamp(1430143759, 9),
            "optimeDate" : ISODate("2015-04-27T14:09:19Z"),
            "lastHeartbeat" : ISODate("2015-04-27T14:09:20.133Z"),
            "lastHeartbeatRecv" : ISODate("2015-04-27T14:09:20.160Z"),
            "pingMs" : 0,
            "electionTime" : Timestamp(1430127299, 1),
            "electionDate" : ISODate("2015-04-27T09:34:59Z"),
            "configVersion" : 109483
        },
        {
            "_id" : 1,
            "name" : "10.0.1.119:27017",
            "health" : 1,
            "state" : 7,
            "stateStr" : "ARBITER",
            "uptime" : 6899,
            "lastHeartbeat" : ISODate("2015-04-27T14:09:20.133Z"),
            "lastHeartbeatRecv" : ISODate("2015-04-27T14:09:20.166Z"),
            "pingMs" : 0,
            "configVersion" : 109483
        },
        {
            "_id" : 2,
            "name" : "10.0.1.179:27017",
            "health" : 1,
            "state" : 3,
            "stateStr" : "RECOVERING",
            "uptime" : 15651,
            "optime" : Timestamp(1430136863, 2),
            "optimeDate" : ISODate("2015-04-27T12:14:23Z"),
            "infoMessage" : "could not find member to sync from",
            "configVersion" : 109483,
            "self" : true
        }
    ],
    "ok" : 1
}

有时,infoMessage“无法找到要同步的成员”在新节点上可见。我注意到当前主服务器上的oplog只有0.12小时(1.7GB),并且需要大约1小时。 2小时复制大部分数据集(如网络使用情况所示)。

假设oplog必须大于这2小时的时间才能成功完成初始同步,这是正确的吗?

1 个答案:

答案 0 :(得分:0)

确实需要oplog(在时间上)比在两个副本之间同步数据的预期时间更长。磁盘很便宜所以我们将OPLOG增加到50GB并重新启动同步,第一次工作。