在mongodb中设置副本集时未找到错误节点

在mongodb中设置副本集时未找到错误节点,mongodb,replicaset,Mongodb,Replicaset,我在尝试从头开始设置MongoDB副本集时遇到了极大的挫折。 我有两台机器运行debian操作系统并安装了mongodb。当我尝试使用rs.add()将成员添加到副本集时,虽然我仍然通过连接到mongodb,但出现了错误 mongo --host 13.212.31.212:27017 下面是错误消息 rs0:PRIMARY> rs.add("13.212.31.212:27017") { "operationTime" : Timesta

我在尝试从头开始设置MongoDB副本集时遇到了极大的挫折。 我有两台机器运行debian操作系统并安装了mongodb。当我尝试使用rs.add()将成员添加到副本集时,虽然我仍然通过连接到mongodb,但出现了错误

mongo --host 13.212.31.212:27017
下面是错误消息

rs0:PRIMARY> rs.add("13.212.31.212:27017")
{
    "operationTime" : Timestamp(1597144435, 1),
    "ok" : 0,
    "errmsg" : "Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: 192.168.0.59:27017; the following nodes did not respond affirmatively: 13.212.31.212:27017 failed with Received heartbeat from member with the same member ID as ourself: 0",
    "code" : 74,
    "codeName" : "NodeNotFound",
    "$clusterTime" : {
            "clusterTime" : Timestamp(1597144440, 1),
            "signature" : {
                    "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                    "keyId" : NumberLong(0)
            }
    }
}
这是mongod配置文件

# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log

# network interfaces
net:
port: 27017
bindIp: 127.0.0.1,172.26.2.229


# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo

我做错了什么?

这是描述性错误消息:

以下1个投票节点响应:192.168.0.59:27017;以下节点未做出肯定响应:13.212.31.212:27017失败,接收到来自与我们自己具有相同成员ID的成员的检测信号:0“


这说明
192.168.0.59:27017
13.212.31.212:27017
是同一个节点,不能添加同一个节点两次。

这是描述性错误消息:

以下1个投票节点响应:192.168.0.59:27017;以下节点未做出肯定响应:13.212.31.212:27017失败,接收到来自成员的心跳,成员ID与我们自己相同:0“


也就是说,
192.168.0.59:27017
13.212.31.212:27017
是同一个节点,不能添加同一个节点两次。

根据这个类似的问题,回答这个错误可能是因为两个节点上都运行了rs.initiate()(您只需要在主节点上运行它)或者您正在添加的节点的数据库路径中已经有数据。为什么在不同的地方提到了两个私有IP范围和一个公共IP范围?根据这个类似的问题和答案,此错误可能是因为两个节点上都运行了rs.initiate()(您只需要在主节点上运行它)或者您正在添加的节点的数据库路径中已经有数据。为什么在不同的地方提到了两个私有IP范围和一个公共IP范围?