Hi Kowshik
I am trying to setup a replicated shard something similar to below.
Could you elaborate on what your goal is? Are you trying to convert a replica set to a sharded cluster?
A replica set is a group of MongoDB servers working together to maintain the same dataset, so the whole deployment achieves high availability and data redundancy (see Replication for more information), whereas a sharded cluster is a method to achieve horizontal scaling using MongoDB (see Sharding for more information).
“errmsg” : “could not find host matching read preference { mode: \”primary\” } for set X.X.X.X:27017,dg-iso-prod1”,
This error typically shows up when you are trying to execute the sh.addShard command to add a replica set as a shard. However, the replica set does not have a Primary at that moment. The shard was therefore cannot be added to the cluster, and the error message is displayed.
Sharding is a relatively advanced concept in MongoDB, and I encourage you to read Considerations before Sharding to determine whether your needs can be better served by a replica set or a sharded cluster.
If you have more questions, could you also post:
rs.status() and/or sh.status())Best regards,
Kevin