Questions About Query Routers and Replicate Set in relation to Shard Clusters

I would like to ask a few questions about sharding, they are as follows:

  1. In a sharded cluster are query routers separate nodes? How are they set up from what I have seen the shareded clusters are configured by setting up the Conf Server and then adding and enabling shards and their DBs or Collections?

  2. Are each Shard and Conf Server a Replicate Set? If so do you have to add all members of a replicate set in Shard Cluster or can you add primary or secondary nodes by themselves?

  3. Other than commands like sh.status() what are methods of checkup can you do to make sure the sharded cluster is working as expected? For example, there arent any hardware issues that are setting the cluster back etc.

Hi @Master_Selcuk and welcome to the community!!

In a sharded collection, the mongos basically route the queries to the respective shards. Whereas the config servers are the metadata for the sharded clusters.

Yes, each shard in sharded cluster is a replica set and starting in MongoDB 3.4 each config server can also be deployed as replica sets. Please see our documentation on replica sets Config server for further details.

Yes, you will need to add all the members of the replica sets in the sharded cluster. Here are the steps on how to deploy a sharded cluster in MongoDB.

sh.status() with db.printShardingStatus() could be other command to view the status of the sharded cluster. For other sharding sharding related command you could visit the documentation on Sharding Commands .

Note that sharding is considered an advanced MongoDB topic. It requires knowledge about operations, security, replica sets, and also specific sharding knowledge (chunks, balancing, shard keys, etc.). These answers are very high-level, and involve only the very basic concepts of a sharded cluster.

I would suggest you to take our University course on cluster administration concepts which would include replication , sharding and other concepts. Visit the course M103: Basic Cluster Administration | MongoDB University.

Let us know if you have any further questions.