Mongodb – Adding secondary via rs.add on MongoDB

mongodb

I have a master and slave on Linux (centOS 7). The rs.initiate(cfg) was done, but its shows the below output when trying to add secondary via rs.add:

genienational:PRIMARY> rs.add("localhost.localdomain:27017")  
{  
     "ok" : 0,  
     "errmsg" : "The hosts test.appraisergenie.com:27017 a  
nd localhost.localdomain:27017 all map to this node new co  
nfiguration version 2 for replica set genienational",  
     "code": 103  
}  
genienational:PRIMARY> use local  
switched to db local  

MongoDB

How do I resolve?

Version: The master is on Enterprise. I think 3.2 and the slave is on 2.6.

Best Answer

The error message in your screenshot indicates you are trying to add identical members to your replica set under different names:

"The hosts x:27017 and y:27017 all map to this node in new configuration".

If you want to configure multiple replica set members on a single machine for testing purposes, all members need to use different ports and/or IP addresses.

Version: The master is on Enterprise. I think 3.2 and the slave is on 2.6.

Mixed-version replica sets are only supported for consecutive major versions (i.e. 3.2 and 3.0) and expected to be used transiently during a rolling upgrade to a new major version of MongoDB. A mixed replica set with 3.2 and 2.6 members is definitely not supported.