gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 09:57:48 38 4
gpt4 key购买 nike

尝试为 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.  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”属性并移动或删除该文件夹中的所有文件。

关于mongodb - 失败,收到来自与我们自己具有相同成员 ID 的成员的心跳 :0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36888396/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com