I'm new at mongodb so this replication is kinda confusing for me. I follow the tutorial here. I have set up 2 mongod instance in my machine:
localhost:27018 localhost:27019
with this command:
mongod --dbpath /home/db2 --port 27019 --replSet "rs1" mongod --dbpath /data/db1 --port 27018 --replSet "rs1"
When I try to connect and set up replication using this set of command
mongo --port 27019 rs1:PRIMARY> rs.add("localhost:27018")
It always says:
{ "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 }
Any help, please ?