MongoDB: 分片方案中的辅助有什么用?

MongoDB: What's the use of a secondary in a sharding scheme?

我已阅读 Google Cloud Platform 关于部署 MongoDB 的 article。使用分片方案,很明显应用程序永远不会从辅助 MongoDB 服务器读取:

Because the production application never reads data from a secondary server, the application never needs to handle the complexity of stale reads and eventual consistency.

我的问题是:

  1. 辅助服务器是否仅用于容错,即在主服务器出现故障时作为备份?或者在同一个分片区域内拥有辅助节点是否有性能优势?

  2. 如果是这样,考虑以下因素:

Compute Engine disks have built-in redundancy to protect data against failures and to ensure data availability through maintenance events

为什么在像 Google 云这样的容错平台上完全需要辅助服务器?

谢谢!

回答两个问题:

副本集的其他好处

副本集还允许您 perform rolling updates to MongoDB 因此对于支持更新很有用。

也可以允许某些应用程序(例如报告应用程序)从次要应用程序读取数据,从而减少主要应用程序的一些负载。 MongoDB 站点上提供了一些详细信息和用例 - https://docs.mongodb.com/v3.2/core/read-preference/

辅助服务器的要求

Google 文章指出:

Barring a catastrophic outage, the MongoDB primary server should always be in this region

通过在副本集中拥有多个成员,您可以保护自己免受这种灾难性中断的影响。如果您需要非常高的可用性,那么您需要这种级别的保护。

MongoDB 自己的数据库即服务 (Atlas) 将副本集成员部署到不同的 Amazon Web Service 可用区以防止这种灾难性中断。