A sharded cluster is comprised of the following elements:
- Two or more shards. Each shard must be a replica set.
- One or more query routers (mongos). A mongos provides an interface between our application and the database.
- A replica set of config servers. Config servers store metadata and configuration settings for the entire cluster.
The relationships between these elements is shown in the following diagram:
![](https://static.packt-cdn.com/products/9781789617870/graphics/assets/0b87bede-ff79-4863-a498-c5c3cf5b86b1.png)
As of MongoDB 3.6, shards must be implemented as replica sets.