I want to setup a replicasetup in my local machine,I am using to instances of mongodb(mongod1.conf,mongod2.conf), rs initiated mongo1 on port 27018 and i want to add the members to 27018 , rs.add('ThinkPad-X230:27019') it is throwing an error called
commands :
mongod --replSet Replicaset1 --dbpath home/data --port 27018
mongo --port 27018
>> rs.initiate()
>> rs.add("ThinkPad-X230:27019")
mongod --dbpath home/data2 --port 27019
mongo --port 27019
i have checked the db.serverStatus().host in 27019 port and adding host name "ThinkPad-X230:27019" to rs.add() members it is throwing the error.
{
"ok" : 0,
"errmsg" : "Either all host names in a replica set configuration must be localhost references, or none must be; found 1 out of 2",
"code" : 103,
"codeName" : "NewReplicaSetConfigurationIncompatible",
"operationTime" : Timestamp(1568943205, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1568943205, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
}