当您对集群中的节点 执行维护 时,Cloud Manager 会执行 滚动重启 。自动化逐个更新集群中的节点,直到更新所有节点,以在维护期间保持集群可用性。
在对集群执行维护之前,请查看以下注意事项,并在必要时采取措施,以保持集群可用性。
注意
要了解自动化如何在集群上执行维护,请参阅Cloud Manager 如何在集群节点上执行维护?
oplog size
Each node in a cluster is restarted in standalone mode before maintenance starts. The node replays writes in the oplog to catch up to the other nodes when it is added back to the cluster after maintenance completes.
Make sure that the cluster's oplog is large enough to store all writes that you application might make during the maintenance period. Use the replication.oplogSizeMB advanced deployment option to adjust the oplog size.
优先级
当在主节点上开始维护时,与该节点的所有客户端连接都会断开。 重新建立与新当选主节点的连接。
您可能更希望将特定数据中心中的节点成为新的主节点。编辑集群的配置并调整每个节点的优先级以指示您的首选主节点。
容错
正在进行维护的节点不为集群提供故障转移支持。 对于三成员副本集,如果在一个节点进行维护时有一个额外的节点不可用,则集群已失去大多数节点。 主节点将失去此状态并降级成为从节点。 在大多数集群节点可用之前,无法选举新的主节点。
对于正常运行时间较长的关键任务应用程序,请考虑在执行维护之前将三成员副本集转换为五成员副本集,以保持集群多数性,以防在维护期间有其他集群节点不可用。
注意
具有五个或更多成员的副本集更具弹性,并且在维护期间失去多数成员的可能性较小。
要提高多重容错能力,一个更简单但弹性较低的选项是在执行维护之前向三成员副本集添加临时仲裁节点。
唯一索引构建
Automation builds indexes on cluster nodes one at a time using identical but independent commands. To ensure that writes respect the unique quality of indexed fields in a unique indexe, all writes to the collection on the cluster must stop before you build the index.
您无法使用数据浏览器或 Cloud Manager 中的自动化配置资源以滚动方式创建唯一索引,因为这些方法不会停止写入集群。
如果您的使用案例要求您构建新的唯一索引:
Stop all writes to the affected collection. For more information. see
db.fsyncLock()in the MongoDB Manual.请参阅 MongoDB 手册中的在副本集上构建索引,以滚动方式构建唯一索引。
提示