失败,来自具有与我们相同的成员ID的成员收到心跳:0

时间:2016-04-27 11:25:50

标签: mongodb

尝试为1个主要,1个从属和1个仲裁程序设置副本集配置。 我在/etc/mongodb.conf

中设置了这个
replication:
  replSetName: ProductionReplicaSet

但是在三台服务器上意外地运行了rs.initiate()。现在当我正在跑步时rs.add("mongo02....")我正在接受:

{
    "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
}

我在这里读到rs.initiate()可以撤销,但说明不明确。

尝试了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
}

任何帮助?我愿意接受其他解决方案。

1 个答案:

答案 0 :(得分:6)

我也参与其中。事实证明,这可能是由两件事引起的。

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.

要解决此问题,您需要检查/etc/mongod.conf中的“dbPath”属性,然后移动或删除该文件夹中的所有文件。