Replicated shard

623 views
Skip to first unread message

Kowshik Nandagudi

unread,
Nov 17, 2016, 6:30:19 PM11/17/16
to mongodb-user
I am trying to setup a replicated shard something similar to below.


But get the error 
 "errmsg" : "could not find host matching read preference { mode: \"primary\" } for set X.X.X.X:27017,dg-iso-prod1",


Any advise please?

Many Thanks in advance

Kowshik


Kevin Adistambha

unread,
Nov 24, 2016, 5:29:31 PM11/24/16
to mongodb-user

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:

  • Your MongoDB version and your O/S version
  • Your current deployment topology (standalone, replica set, sharded cluster) and relevant information about the state of your deployment (e.g. output of rs.status() and/or sh.status())
  • Your goal, and what you have tried to achieve it
  • Any error messages and the relevant logs

Best regards,
Kevin

Reply all
Reply to author
Forward
0 new messages