如果具有大多数成员的数据中心宕机,副本集将只能提供读服务。
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),最佳实践将其分布在三个或更多(取决于成员的数量)的数据中心上。如果第三个数据中心的成本太高,一种可能的分布方式是将承载数据的成员均匀分布到两个数据中心,并在公司政策允许的情况下将其余成员存储在云中。
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
and Distribution
Deploying multiple mongos
routers supports high availability and scalability. A common pattern is to place a mongos
on each application server. Deploying one mongos
router on each application server reduces network latency between the application and the router. 部署多个mongos
实例可支持高可用性和可扩展性。一个常见的模式是在每个应用程序服务器上部署一个 mongos
实例。在每个应用服务器上部署一个 mongos
实例可以减少应用程序和mongos之间的网络延迟。 Alternatively, you can place a mongos
router on dedicated hosts. Large deployments benefit from this approach because it decouples the number of client application servers from the number of mongos
instances. This gives greater control over the number of connections the mongod
instances serve. 另外,您也可以在专用主机上部署 mongos
实例。大型部署可从此方法中受益,因为它使客户端应用程序服务器的数量与mongos节点的数量脱钩,可以更好地控制mongod
实例服务的连接数。 Installing mongos
instances on their own hosts allows these instances to use greater amounts of memory. Memory would not be shared with a mongod
instance. It is possible to use primary shards to host mongos
routers but be aware that memory contention may become an issue on large deployments. 在自己的主机上安装 mongos
实例允许这些实例使用更多的内存。内存不会与mongod
实例共享。您也可以使用主分片来托管 mongos
,但是要注意,在大型部署中,内存争抢可能会成为一个问题。 There is no limit to the number of mongos
routers you can have in a deployment. However, as mongos
routers 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 mongos
routers in your deployment. mongos
的部署数量没有限制。但是,由于mongos
经常与配置服务器通信,当您增加mongos数量时,请密切关注配置服务器的性能。如果发现性能下降,最好限制您部署的mongos
数量。 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:
为了进行测试和开发,您可以部署最少组件数量的分片集群。非生产群集具备以下组件: