- On this page
- 内容概览A MongoDB sharded cluster consists of the following components:一个MongoDB分片集群由以下组件组成：
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:
mongos。Replica Set Distribution分散部署副本集Where possible, consider deploying one member of each replica set in a site suitable for being a disaster recovery location.在可能的情况下，请考虑在适合作为灾难恢复位置的站点中，部署每个副本集的一个成员。NOTE注意Distributing replica set members across two data centers provides benefit over a single data center. In a two data center distribution,在两个数据中心分散部署副本集成员比在单个数据中心部署具备下述优势：
- If one of the data centers goes down, the data is still available for reads unlike a single data center distribution.
- If the data center with a minority of the members goes down, the replica set can still serve write operations as well as read operations.
- However, if the data center with the majority of the members goes down, the replica set becomes read-only.
- 如果具有大多数成员的数据中心宕机，副本集将只能提供读服务。If possible, distribute members across at least three data centers. For config server replica sets (CSRS), the best practice is to distribute across three (or more depending on the number of members) centers. If the cost of the third data center is prohibitive, one distribution possibility is to evenly distribute the data bearing members across the two data centers and store the remaining member in the cloud if your company policy allows.如果可能，请将成员分布到至少三个数据中心。对于配置服务器副本集(CSRS)，最佳实践将其分布在三个或更多（取决于成员的数量）的数据中心上。如果第三个数据中心的成本太高，一种可能的分布方式是将承载数据的成员均匀分布到两个数据中心，并在公司政策允许的情况下将其余成员存储在云中。Number of Shards分片数量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.分片集群需要至少两个分片来分发分片数据。如果您计划在不久的将来启用分片，那么单个分片的集群可能很有用，但在部署时不需要启用。Number of
mongos数量和分布There is no limit to the number of
mongosrouters you can have in a deployment. However, as
mongosrouters communicate frequently with your config servers, monitor config server performance closely as you increase the number of routers. If you see performance degradation, it may be beneficial to cap the number of
mongosrouters in your deployment.Development Configuration开发环境配置For testing and development, you can deploy a sharded cluster with a minimum number of components. These non-production clusters have the following components:为了进行测试和开发，您可以部署最少组件数量的分片集群。非生产群集具备以下组件：
Use the test cluster architecture for testing and development only.