金融应用场景下跨数据中心的MGR架构方案——下篇

内容提纲

  • 1、什么是Async Replication Auto failover
  • 2、基于MGR的两地三中心数据库架构方案
  • 3、配置Async Replication Auto failover
  • 4、模拟故障,确认可自动切换
如何在多个数据中心部署多套MGR集群,并实现故障快速切换。

上篇文章介绍了如何在多数据中心部署多套MGR集群,并构建集群间的复制通道。这样一旦主AZ不可用时,在校验完数据后,就可以切换到备用AZ的MGR集群,非常方便。

本文我们继续深入介绍如何利用 Async Replication Auto failover 实现故障自动转移的。

1、什么是Async Replication Auto failover

从MySQL 8.0.22开始,推出一个新特性"Async Replication Auto failover",当MGR集群发生故障时,其从库可以更方便的实现快速自动切主。直译过来是“异步复制自动故障转移”,但实际上它也是支持半同步复制场景的。

You can use MySQL Server's new asynchronous connection failover mechanism to automatically establish an asynchronous (source to replica) replication connection to a new source after the existing connection from a replica to its source fails. The connection fails over if the replication I/O thread stops due to the source stopping or due to a network failure. The asynchronous connection failover mechanism can be used to keep a replica synchronized with multiple MySQL servers or groups of servers that share data. To activate asynchronous connection failover for a replication channel set SOURCE_CONNECTION_AUTO_FAILOVER=1 on the CHANGE MASTER TO statement for the channel, and set up a source list for the channel using the asynchronous_connection_failover_add_source and asynchronous_connection_failover_delete_source functions.