- 19.1.5.1 配置多源复制19.1.5.1 Configuring Multi-Source Replication
- 19.1.5.2 为基于 GTID 的复制准备多源副本19.1.5.2 Provisioning a Multi-Source Replica for GTID-Based Replication
- 19.1.5.3 向多源副本添加基于 GTID 的源19.1.5.3 Adding GTID-Based Sources to a Multi-Source Replica
- 19.1.5.4 向多源副本添加基于二进制日志的复制源19.1.5.4 Adding Binary Log Based Replication Sources to a Multi-Source Replica
- 19.1.5.5 启动多源副本19.1.5.5 Starting Multi-Source Replicas
- 19.1.5.6 停止多源副本19.1.5.6 Stopping Multi-Source Replicas
- 19.1.5.7 重置多源副本19.1.5.7 Resetting Multi-Source Replicas
- 19.1.5.8 监控多源复制19.1.5.8 Monitoring Multi-Source Replication
MySQL 8.4 中的多源复制使得一个从库可以并行地从多个直接源接收事务。在多源复制拓扑中,从库为它应该接收事务的每个源创建一个复制通道。有关复制通道如何工作的更多信息,请参见 第 19.2.2 节,“复制通道”。Multi-source replication in MySQL 8.4 enables a replica to receive transactions from multiple immediate sources in parallel. In a multi-source replication topology, a replica creates a replication channel for each source that it should receive transactions from. For more information on how replication channels function, see Section 19.2.2, “Replication Channels”.
您可能会选择实现多源复制以实现以下目标:You might choose to implement multi-source replication to achieve goals like these:
将多个服务器备份到单个服务器。Backing up multiple servers to a single server.
合并表分片。Merging table shards.
将来自多个服务器的数据整合到单个服务器。Consolidating data from multiple servers to a single server.
在应用事务时,多源复制不执行任何冲突检测或解决操作,这些任务如果需要,则由应用程序处理。Multi-source replication does not implement any conflict detection or resolution when applying transactions, and those tasks are left to the application if required.
每个多源副本上的通道必须从不同的源进行复制。不能将单个副本的多个复制通道设置为来自单个源。这是因为副本的服务器 ID 在复制拓扑中必须是唯一的。源仅通过服务器 ID 来区分副本,而不是通过复制通道的名称,因此无法识别来自同一副本的不同复制通道。Each channel on a multi-source replica must replicate from a different source. You cannot set up multiple replication channels from a single replica to a single source. This is because the server IDs of replicas must be unique in a replication topology. The source distinguishes replicas only by their server IDs, not by the names of the replication channels, so it cannot recognize different replication channels from the same replica.
多源副本也可以设置为多线程副本,通过将系统变量 replica_parallel_workers 设置为大于 0 的值。当你在多源副本上执行此操作时,副本上的每个通道都有指定数量的应用线程,以及一个协调线程来管理它们。你不能为单独的通道配置应用线程的数量。A multi-source replica can also be set up as a multi-threaded
replica, by setting the system variable
replica_parallel_workers to a value
greater than 0. When you do this on a multi-source replica, each
channel on the replica has the specified number of applier threads,
plus a coordinator thread to manage them. You cannot configure the
number of applier threads for individual channels.
MySQL 8.4 还支持在多源复制中对特定复制通道使用复制过滤器。当同一个数据库或表存在于多个源上时,可以使用通道特定的复制过滤器,并且您只需要让副本从一个源进行复制。对于基于 GTID 的复制,如果同一个事务可能来自多个源(例如在菱形拓扑中),必须确保所有通道上的过滤设置相同。有关更多信息,请参阅 第 19.2.5.4 节,“基于通道的复制过滤器”。MySQL 8.4 also supports replication filters on specific replication channels with multi-source replicas. Channel specific replication filters can be used when the same database or table is present on multiple sources, and you only need the replica to replicate it from one source. For GTID-based replication, if the same transaction might arrive from multiple sources (such as in a diamond topology), you must ensure the filtering setup is the same on all channels. For more information, see Section 19.2.5.4, “Replication Channel Based Filters”.
本节提供了关于如何配置多源复制的源和副本、如何启动、停止和重置多源副本,以及如何监控多源复制的教程。This section provides tutorials on how to configure sources and replicas for multi-source replication, how to start, stop and reset multi-source replicas, and how to monitor multi-source replication.