MongoDB主副本集成员同步到辅助副本

时间:2013-09-25 12:45:09

标签: mongodb replication

我有一个副本集,有三个成员,host0:27100作为主要成员。最近我更改了配置并将host2:27102作为主要成员。关注these个文档。

更改配置后,rs.status()输出显示host1:27101"syncingTo" : "host2:27102"

但是新主host2:27102的输出显示它是"syncingTo" : "host0:27100",它是之前的主要成员,并且已更改为次要成员。

我无法理解为什么它与次要成员同步。这是正常行为吗?

s0:SECONDARY> rs.status()
{
        "set" : "s0",
        "date" : ISODate("2013-09-25T12:31:42Z"),
        "myState" : 2,
        "syncingTo" : "host2:27102",
        "members" : [
                {
                        "_id" : 0,
                        "name" : "host0:27100",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "uptime" : 428068,
                        "optime" : Timestamp(1380112272, 1),
                        "optimeDate" : ISODate("2013-09-25T12:31:12Z"),
                        "self" : true
                },
                {
                        "_id" : 1,
                        "name" : "host1:27101",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "uptime" : 397,
                        "optime" : Timestamp(1380112272, 1),
                        "optimeDate" : ISODate("2013-09-25T12:31:12Z"),
                        "lastHeartbeat" : ISODate("2013-09-25T12:31:42Z"),
                        "lastHeartbeatRecv" : ISODate("2013-09-25T12:31:41Z"),
                        "pingMs" : 10,
                        "syncingTo" : "host2:27102"
                },
                {
                        "_id" : 2,
                        "name" : "host2:27102",
                        "health" : 1,
                        "state" : 1,
                        "stateStr" : "PRIMARY",
                        "uptime" : 397,
                        "optime" : Timestamp(1380112272, 1),
                        "optimeDate" : ISODate("2013-09-25T12:31:12Z"),
                        "lastHeartbeat" : ISODate("2013-09-25T12:31:42Z"),
                        "lastHeartbeatRecv" : ISODate("2013-09-25T12:31:41Z"),
                        "pingMs" : 2,
                        "syncingTo" : "host0:27100"
                }
        ],
        "ok" : 1
}

1 个答案:

答案 0 :(得分:1)

这是一个已知问题。有一个关于rs.status()的开放票据,如果当前主要是过去的辅助节点(SERVER-9989),则从辅助节点运行时显示主节点为syncingTo。修复版本为2.5.1