Replication in MySQL Cluster makes use of a number of dedicated
tables in the mysql database on each MySQL
Server instance acting as an SQL node in both the cluster being
replicated and the replication slave (whether the slave is a
single server or a cluster). These tables are created during the
MySQL installation process by the
mysql_install_db script, and include a table
for storing the binary log's indexing data. Since the
ndb_binlog_index table is local to each MySQL
server and does not participate in clustering, it uses the
MyISAM storage engine. This means that it
must be created separately on each mysqld
participating in the master cluster. (However, the binlog itself
contains updates from all MySQL servers in the cluster to be
replicated.) This table is defined as follows:
CREATE TABLE `ndb_binlog_index` (
`Position` BIGINT(20) UNSIGNED NOT NULL,
`File` VARCHAR(255) NOT NULL,
`epoch` BIGINT(20) UNSIGNED NOT NULL,
`inserts` BIGINT(20) UNSIGNED NOT NULL,
`updates` BIGINT(20) UNSIGNED NOT NULL,
`deletes` BIGINT(20) UNSIGNED NOT NULL,
`schemaops` BIGNINT(20) UNSIGNED NOT NULL,
PRIMARY KEY (`epoch`)
) ENGINE=MYISAM DEFAULT CHARSET=latin1;
Important: Prior to MySQL
5.1.14, the ndb_binlog_index table was known
as binlog_index, and was kept in a separate
cluster database, which in MySQL 5.1.7 and
earlier was known as the cluster_replication
database. Similarly, the ndb_apply_status and
ndb_schema tables were known as
apply_status and schema,
and were also found in the cluster (earlier
cluster_replication) database. However,
beginning with MySQL 5.1.14, all MySQL Cluster replication
tables reside in the mysql system database.
Information about how this change affects upgrades from MySQL Cluster 5.1.13 and earlier to 5.1.14 and later versions can be found in Section C.1.5, “Changes in release 5.1.14 (05 December 2006)”.
The following figure shows the relationship of the MySQL Cluster
replication master server, its binlog injector thread, and the
mysql.ndb_binlog_index table.

An additional table, named ndb_apply_status,
is used to keep a record of the operations that have been
replicated from the master to the slave. Unlike the case with
ndb_binlog_index, the data in this table is
not specific to any one SQL node in the (slave) cluster, and so
ndb_apply_status can use the NDB
Cluster storage engine, as shown here:
CREATE TABLE `ndb_apply_status` (
`server_id` INT(10) UNSIGNED NOT NULL,
`epoch` BIGINT(20) UNSIGNED NOT NULL,
PRIMARY KEY USING HASH (`server_id`)
) ENGINE=NDBCLUSTER DEFAULT CHARSET=latin1;
The ndb_binlog_index and
ndb_apply_status tables are created in the
mysql database because they should not be
replicated. No user intervention is normally required to create
or maintain either of them. Both the
ndb_binlog_index and the
ndb_apply_status tables are maintained by the
NDB injector thread. This keeps the master
mysqld process updated to changes performed
by the NDB storage engine. The
NDB binlog injector
thread receives events directly from the
NDB storage engine. The
NDB injector is responsible for capturing all
the data events within the cluster, and ensures that all events
which change, insert, or delete data are recorded in the
ndb_binlog_index table. The slave I/O thread
transfers the events from the master's binary log to the slave's
relay log.
However, it is advisable to check for the existence and
integrity of these tables as an initial step in preparing a
MySQL Cluster for replication. It is possible to view event data
recorded in the binary log by querying the
mysql.binlog_index table directly on the
master. This can be also be accomplished using the SHOW
BINLOG EVENTS statement on either the replication
master or slave MySQL servers. (See
Section 13.6.1.4, “SHOW BINLOG EVENTS Syntax”.)
You can also obtain useful information from the output of
SHOW ENGINE NDB
STATUS.
Note: Beginning with MySQL
5.1.14, if the apply_status table does not
exist on the slave, it is created by
ndb_restore. (Bug#14612)

User Comments
Add your own comment.