问题
Trying to set a replica set configuration for 1 primary , 1 slave and 1 arbitrator.
I have setup this in the /etc/mongodb.conf
replication:
replSetName: ProductionReplicaSet
but accidentally ran rs.initiate()
on the three servers. now when I'm running rs.add("mongo02....")
i'm getting :
{
"ok" : 0,
"errmsg" : "Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: chef-production2-mongo01:27017; the following nodes did not respond affirmatively: mongo02...:27017 failed with Received heartbeat from member with the same member ID as ourself: 0",
"code" : 74
}
I read here that rs.initiate()
can be reversed but the instructions are not clear.
tried on mongo02:
config = rs.config() //config with _id :0
config["members"][0]["_id"] = 1
rs.reconfig(config)
{
"ok" : 0,
"errmsg" : "New and old configurations both have members with host of chef-production2-mongo02:27017 but in the new configuration the _id field is 1 and in the old configuration it is 0 for replica set ProductionReplicaSet",
"code" : 103
}
any help? i'm open to other solutions.
回答1:
I ran in to this as well. Turns out it can be caused by two things.
1. If the node you are adding already has its own dbData.
2. If you ran rs.initiate() on both nodes. It is only supposed to be run on the primary.
To resolve this you will need to check /etc/mongod.conf for the "dbPath" attribute and move or remove all the files in that folder.
来源:https://stackoverflow.com/questions/36888396/failed-with-received-heartbeat-from-member-with-the-same-member-id-as-ourself0