Docs Menu
Docs Home
/
Database Manual
/

Sharded Cluster Components

A MongoDB sharded cluster consists of the following components:

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:

For production deployments, we recommend deplying config server and shard replica sets on at least three data centers. This configuration provides high availability in case a single data center goes down.

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.

mongos routers support high availability and scalability when deploying multiple mongos instances. If a proxy or load balancer is between the application and the mongos routers, you must configure it for client affinity. Client affinity allows every connection from a single client to reach the same mongos. For shard-level high availability, either:

  • Add mongos instances on the same hardware where mongos instances are already running.

  • Embed mongos routers at the application level.

mongos routers communicate frequently with your config servers. As you increase the number of routers, performance may degrade. If performance degrades, reduce the number of routers.

The following diagram shows a common sharded cluster architecture used in production:

Diagram that shows a production-level sharded cluster
containing multiple shards and mongos routers.

For testing and development, you can deploy a sharded cluster with a minimum number of components. These non-production clusters have the following components:

The following diagram shows a sharded cluster architecture used for development only:

Diagram that shows a development sharded cluster
containing a single shard and mongos router.

Warning

Use the test cluster architecture for testing and development only.

See also:

Back

Sharding

On this page