Consider we have 3 node N1, N2, N3.
- On Node 1
mongod instance with port 26000 with replica set
rs0(Primary) mongod instance with port 26001 with replica set
rs1(Arbiter) mongod instance with port 26002 with replica set
rs2(Secondary) - On Node 2 mongod instance with port 26000 with replica set rs0(Secondary) mongod instance with port 26001 with replica set rs1(Primary) mongod instance with port 26002 with replica set rs2(Arbiter)
- On Node 3 mongod instance with port 26000 with replica set rs0(Secondary) mongod instance with port 26001 with replica set rs1(Arbiter) mongod instance with port 26002 with replica set rs2(Primary)
Now we have 3 standalone shards with replication sets each have one secondary and Arbiter On Node 1, we start configserver on port 27019, next we also start one mongos instance using this configsvr instance , and then add each shard to it. Now my question is my java code which inserts document should talk to this mongos instance for inserting documents, or i can insert them directly in any shared through primary instance they will automatically split the data accordingly.