When I try to add a new node to my replicate set I get this message:
{ "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"
}
I had the same error and impossible to find out why ... I come back on the post to send the solution if others pass here.
Simply do not initialize the replicate on both servers:
I have two separate X and Y servers without mongodb, X and Y are IP addresses or domains.
- Install mongodb on both servers
- Edit the
sudo nano /etc/mongod.conf
configuration files on both servers - [in file] Replace
bindIp: 127.0.0.1
withbindIp: 127.0.0.1,X
on the X server - [in file] Replace
bindIp: 127.0.0.1
withbindIp: 127.0.0.1,Y
on the Y server - [in file] Replace
#replication:
withreplication:
on both servers - [in file] Add
replSetName: "myReplicatName"
line underreplication:
on both servers - Launch mongo with the configuration file on both servers
- Only on server X run
mongo
and type commands
Mongo commands:
rs.initiate ({
_id: "rs0",
members: [{
_id: 1,
host: "X:27017"
}]
});
rs.add("Y:YPORT");
来源:https://stackoverflow.com/questions/41962117/replicasetid-conflict-while-adding-node-mongodb