- Sharding is used to create a cluster of MongoDB instances consisting of at least three servers.
- There are three types of elements in Sharded Cluster.
-
- Shards
- Query Router
- Config server
Shards :
- It is a single MongoDB instance that holds a subset of the sharded data.
- It can be deployed as replica sets to provide redundancy and increase availability.
- The combination of multiple shards creates a complete data set.
Query router :
- Query router acts as a Mongos providing a stable interface between the application and the sharded cluster.
- In this MongoDB instance is responsible for routing the client requests to the correct shard.
Config Server :
- Config Server becomes to store the metadata (Data about the data) and the configuration settings for the whole cluster.