当我尝试将新节点添加到我的复制集时,我收到以下消息:
{ "ok" : 0, "errmsg" : "Our replica set ID of 5890ad86c92c6c88e8573df0 did not match that of 10.0.253.3:27017, which is 5890a6b137e1380d1e697f2a", "code" : 103, "codeName" : "NewReplicaSetConfigurationIncompatible"
}
答案 0 :(得分:4)
我有同样的错误,无法找出原因......如果其他人通过这里,我会回到帖子上发送解决方案。
我有两个独立的X和Y服务器没有mongodb,X和Y是IP地址或域。
sudo nano /etc/mongod.conf
配置文件bindIp: 127.0.0.1
替换为X服务器上的bindIp: 127.0.0.1,X
bindIp: 127.0.0.1
替换为Y服务器上的bindIp: 127.0.0.1,Y
#replication:
替换为replication:
replSetName: "myReplicatName"
下添加replication:
行mongo
并输入命令Mongo命令:
rs.initiate ({
_id: "rs0",
members: [{
_id: 1,
host: "X:27017"
}]
});
rs.add("Y:YPORT");