文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 25 MySQL NDB 集群 8.4 / 25.7 NDB 集群复制 / 25.7.7 使用两个复制通道进行 NDB Cluster 复制
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

25.7.7 在 NDB 集群复制中使用两个复制通道25.7.7 Using Two Replication Channels for NDB Cluster Replication

在一个更完整的示例场景中,我们设想有两个复制通道以提供冗余,从而防止单个复制通道可能出现的故障。这需要总共四台复制服务器,源集群上有两台源服务器,副本集群上有两台副本服务器。在接下来的讨论中,我们假设唯一标识符如图所示分配:In a more complete example scenario, we envision two replication channels to provide redundancy and thereby guard against possible failure of a single replication channel. This requires a total of four replication servers, two source servers on the source cluster and two replica servers on the replica cluster. For purposes of the discussion that follows, we assume that unique identifiers are assigned as shown here:

表 25.45 文本中描述的 NDB 集群复制服务器Table 25.45 NDB Cluster replication servers described in the text

服务器 IDServer ID 说明Description
1 源 - 主复制通道 (S)Source - primary replication channel (S)
2 源 - 次复制通道 (S')Source - secondary replication channel (S')
3 副本 - 主复制通道 (R)Replica - primary replication channel (R)
4 副本 - 次复制通道 (R')replica - secondary replication channel (R')

使用两个通道设置复制与设置单个复制通道并没有本质上的不同。首先,必须启动主复制源服务器和次级复制源服务器的 mysqld 进程,然后启动主副本和次级副本的进程。可以通过在每个副本上发出 START REPLICA 语句来启动复制进程。需要发出的命令及其顺序如下所示:Setting up replication with two channels is not radically different from setting up a single replication channel. First, the mysqld processes for the primary and secondary replication source servers must be started, followed by those for the primary and secondary replicas. The replication processes can be initiated by issuing the START REPLICA statement on each of the replicas. The commands and the order in which they need to be issued are shown here:

  1. 启动主复制源:Start the primary replication source:

    shellS> mysqld --ndbcluster --server-id=1 \
                   --log-bin &
    
  2. 启动次级复制源:Start the secondary replication source:

    shellS'> mysqld --ndbcluster --server-id=2 \
                   --log-bin &
    
  3. 启动主副本服务器:Start the primary replica server:

    shellR> mysqld --ndbcluster --server-id=3 \
                   --skip-replica-start &
    
  4. 启动次级副本服务器:Start the secondary replica server:

    shellR'> mysqld --ndbcluster --server-id=4 \
                    --skip-replica-start &
    
  5. 最后,通过在主副本上执行START REPLICA语句,在主通道上启动复制,如下所示:Finally, initiate replication on the primary channel by executing the START REPLICA statement on the primary replica as shown here:

    mysqlR> START REPLICA;
    
    Warning

    此时只需要启动主通道。只有在主复制通道发生故障时,才需要启动辅助复制通道,如第 25.7.8 节,“使用 NDB 集群复制实现故障切换”中所述。同时运行多个复制通道可能导致在副本上创建不需要的重复记录。Only the primary channel must be started at this point. The secondary replication channel needs to be started only in the event that the primary replication channel fails, as described in Section 25.7.8, “Implementing Failover with NDB Cluster Replication”. Running multiple replication channels simultaneously can result in unwanted duplicate records being created on the replicas.

如前所述,副本上不需要启用二进制日志。As mentioned previously, it is not necessary to enable binary logging on the replicas.