I have two PCs with Ips 10.1.1.52 and 10.1.1.11
I want to configure mongo replication (without sharding) with one primary and one secondary node running on 10.1.1.52 and one secondary node running on 10.1.1.11.
Untill now what I have done is as follows::
Ran three config servers on 10.1.1.11 PC with the following commands::
mongod --configsvr --port 26050 --logpath /data/db/log.cfg0 --logappend --dbpath /data/db/cfg0 –fork mongod --configsvr --port 26051 --logpath /data/db/log.cfg1 --logappend --dbpath /data/db/cfg1 –fork mongod --configsvr --port 26052 --logpath /data/db/log.cfg2 --logappend --dbpath /data/db/cfg2 –fork
Following which I created a replica set ('a') and added three nodes to it by using the following commands::
(The first instance is running on 10.1.1.11 & the other two on 10.1.1.52)
mongod --replSet a --dbpath /data/a/a0 --logpath /data/a/log.a0 --port 27000 --fork --logappend --smallfiles --oplogSize 50 mongod --replSet a --dbpath /data/a/a1 --logpath /data/a/log.a1 --port 27001 --fork --logappend --smallfiles --oplogSize 50 mongod --replSet a --dbpath /data/a/a2 --logpath /data/a/log.a2 --port 27002 --fork --logappend --smallfiles --oplogSize 50
Setting up Query Routers on 10.1.1.11with the following command ::
mongos --configdb gaugedata-elastic:26050,gaugedata-elastic:26051,gaugedata-elastic:26052 --fork --logappend --logpath /data/db/log.mongos --port 26060
After that entererd the following command to connect from mongos::
mongo --port 27000
rs.initiate()
THE PROBLEM THAT IS BEING FACED IS AFTER ADDING THE NODES::
rs.add("10.1.1.52:27001") rs.add("10.1.1.52:27002")
The nodes running on remote PC i.e. 10.1.1.52 are not reachable and unhealthy. However the node running on my PC i.e. 10.1.1.11 is automatically declared as SECONDARY.