简体   繁体   中英

MongoDB Primary replica set member syncing to secondary

I have a replica set having three members, with host0:27100 as a primary member. Recently i changed the configuration and made the host2:27102 as primary member. Followed these docs.

After changing the configuratio, the rs.status() output says that the host1:27101 is "syncingTo" : "host2:27102" which is intended.

But the output for new primary host2:27102 shows it is "syncingTo" : "host0:27100" which is the previous primary member, and changed into secondary.

I cannot understand why its syncing to the secondary member. Is it a normal behavior?

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
}

This is a known issue. There is an open ticket about rs.status() showing the primary as syncingTo when run from a secondary if the current primary was a secondary in the past ( SERVER-9989 ). Fix verion is 2.5.1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM