一个复制通道需要两个 MySQL 服务器作为复制服务器(每个复制源和副本各一个)。例如,这意味着在具有两个复制通道的复制设置中(为冗余提供额外通道),总共应有四个复制节点,每个集群两个。A replication channel requires two MySQL servers acting as replication servers (one each for the source and replica). For example, this means that in the case of a replication setup with two replication channels (to provide an extra channel for redundancy), there should be a total of four replication nodes, two per cluster.
如本节及以下章节所述,NDB 集群的复制依赖于基于行的复制。这意味着复制源 MySQL 服务器必须以 --binlog-format=ROW 或 --binlog-format=MIXED 运行,如 第 25.7.6 节,“启动 NDB 集群复制(单复制通道)” 所述。有关基于行的复制的一般信息,请参阅 第 19.2.1 节,“复制格式”。Replication of an NDB Cluster as described in this section and
those following is dependent on row-based replication. This means
that the replication source MySQL server must be running with
--binlog-format=ROW or
--binlog-format=MIXED, as described
in Section 25.7.6, “Starting NDB Cluster Replication (Single Replication Channel)”. For
general information about row-based replication, see
Section 19.2.1, “Replication Formats”.
如果您尝试使用 NDB 集群复制配合 --binlog-format=STATEMENT,复制将无法正常工作,因为源集群上的 ndb_binlog_index 表和副本集群上的 ndb_apply_status 表的 epoch 列不会被更新(参见 第 25.7.4 节,“NDB 集群复制的架构和表”)。相反,只有作为复制源的 MySQL 服务器上的更新会传播到副本,而源集群中其他任何 SQL 节点的更新都不会被复制。If you attempt to use NDB Cluster Replication with
--binlog-format=STATEMENT,
replication fails to work properly because the
ndb_binlog_index table on the source cluster
and the epoch column of the
ndb_apply_status table on the replica cluster
are not updated (see
Section 25.7.4, “NDB Cluster Replication Schema and Tables”). Instead,
only updates on the MySQL server acting as the replication
source propagate to the replica, and no updates from any other
SQL nodes in the source cluster are replicated.
--binlog-format 选项的默认值是 MIXED。The default value for the
--binlog-format option is
MIXED.
用于任一集群复制的每个 MySQL 服务器在参与任一集群的所有 MySQL 复制服务器中必须具有唯一标识(不能在源集群和副本集群中共用相同的复制服务器 ID)。可以通过使用 --server-id= 选项启动每个 SQL 节点来实现,其中 idid 是一个唯一整数。虽然这不是严格必要的,但为了本讨论,我们假设所有 NDB Cluster 二进制文件的版本都是相同的。Each MySQL server used for replication in either cluster must be
uniquely identified among all the MySQL replication servers
participating in either cluster (you cannot have replication
servers on both the source and replica clusters sharing the same
ID). This can be done by starting each SQL node using the
--server-id= option,
where idid is a unique integer. Although
it is not strictly necessary, we assume for purposes of this
discussion that all NDB Cluster binaries are of the same release
version.
在 MySQL 复制中,一般来说,涉及的两个 MySQL 服务器(mysqld 进程)必须在复制协议版本和支持的 SQL 功能集方面相互兼容(参见 第 19.5.2 节,“MySQL 版本之间的复制兼容性”)。正是由于 NDB 集群和 MySQL Server 8.4 分发中的二进制文件之间的这些差异,NDB 集群复制对两个 mysqld 二进制文件有额外要求,必须来自 NDB 集群分发。确保 mysqld 服务器兼容的最简单、最容易的方法是为所有源和副本 mysqld 二进制文件使用相同的 NDB 集群分发。It is generally true in MySQL Replication that both MySQL servers (mysqld processes) involved must be compatible with one another with respect to both the version of the replication protocol used and the SQL feature sets which they support (see Section 19.5.2, “Replication Compatibility Between MySQL Versions”). It is due to such differences between the binaries in the NDB Cluster and MySQL Server 8.4 distributions that NDB Cluster Replication has the additional requirement that both mysqld binaries come from an NDB Cluster distribution. The simplest and easiest way to assure that the mysqld servers are compatible is to use the same NDB Cluster distribution for all source and replica mysqld binaries.
我们假设副本服务器或集群专用于源集群的复制,并且其上不存储其他数据。We assume that the replica server or cluster is dedicated to replication of the source cluster, and that no other data is being stored on it.
所有正在复制的 NDB 表必须使用 MySQL 服务器和客户端创建。使用 NDB API 创建的表和其他数据库对象(例如,使用 Dictionary::createTable())对 MySQL 服务器不可见,因此不会被复制。NDB API 应用对使用 MySQL 服务器创建的现有表的更新可以被复制。All NDB tables being replicated must be created
using a MySQL server and client. Tables and other database objects
created using the NDB API (with, for example,
Dictionary::createTable()) are
not visible to a MySQL server and so are not replicated. Updates
by NDB API applications to existing tables that were created using
a MySQL server can be replicated.
可以使用基于语句的复制来复制 NDB 集群。然而,在这种情况下,适用以下限制:It is possible to replicate an NDB Cluster using statement-based replication. However, in this case, the following restrictions apply:
对作为源的集群上的数据行的所有更新必须指向单个 MySQL 服务器。All updates to data rows on the cluster acting as the source must be directed to a single MySQL server.
无法使用多个同时进行的 MySQL 复制进程来复制集群。It is not possible to replicate a cluster using multiple simultaneous MySQL replication processes.
只有在 SQL 级别进行的更改会被复制。Only changes made at the SQL level are replicated.
这些是基于语句的复制相对于基于行的复制的其他限制之外的额外限制;有关两种复制格式之间差异的更具体信息,请参见 第 19.2.1.1 节,“基于语句和基于行的复制的优缺点”。These are in addition to the other limitations of statement-based replication as opposed to row-based replication; see Section 19.2.1.1, “Advantages and Disadvantages of Statement-Based and Row-Based Replication”, for more specific information concerning the differences between the two replication formats.