- Sharding >
- Sharded Cluster Components
Sharded Cluster Components¶
A MongoDB sharded cluster consists of the following components:
- shard: Each shard contains a subset of the sharded data. Each shard can be deployed as a replica set.
- mongos: The
mongosacts as a query router, providing an interface between client applications and the sharded cluster.
- config servers: Config servers store metadata and configuration settings for the cluster. As of MongoDB 3.4, config servers must be deployed as a replica set (CSRS).
In a production cluster, ensure that data is redundant and that your systems are highly available. Consider the following for a production sharded cluster deployment:
- Deploy Config Servers as a 3 member replica set
- Deploy each Shard as a 3 member replica set
- Deploy one or more
Where possible, consider deploying one member of each replica set in a site suitable for being a disaster recovery location.
Sharding requires at least two shards to distribute sharded data. Single shard sharded clusters may be useful if you plan on enabling sharding in the near future, but do not need to at the time of deployment.
You can deploy a
mongos router on each application server to ensure
each server has consistent access to the sharded cluster. Alternatively,
deploy a group of
mongos routers and use a proxy or load balancer
between the application and the
mongos group. In these deployments,
you must configure the load balancer for client affinity such that every
connection from a single client reaches the same
For testing and development, you can deploy a sharded cluster with a minimum number of components. These non-production clusters have the following components:
- A replica set config server with one member.
- At least one shard as a single-member replica set.
Use the test cluster architecture for testing and development only.
© MongoDB, Inc 2008-2017. MongoDB, Mongo, and the leaf logo are registered trademarks of MongoDB, Inc.