Recently, I was asked if it is possible to replicate an NDB cluster to a non-NDB MySQL database. So, I tried!
I created the following table on the MySQL master:
Create Table: CREATE TABLE `testrepl` ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
and on the slave:
Create Table: CREATE TABLE `testrepl` ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1
Of course, for obvious reasons, NDB only supports row based replication so I configured the master to use row based:
mysql> show global variables like 'binlog_format'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | binlog_format | ROW | +---------------+-------+ 1 row in set (0.00 sec)
Then I tried and go the following error:
Last_Error: Error 'Incorrect information in file: './mysql/ndb_apply_status.frm'' on opening tables
Of course, the slave has no “ndb” tables in the mysql database. At that point, I had two choices, create fake ndb tables on the slave or restrict the replication to only the databases I want. I chose the later one and added
replicate-do-db = repl
in the my.cnf of the slave. From there, it worked perfectly, an insert on the master appeared normally on the slave. I also tried using InnoDB on the slave instead of MyIsam and it worked as well. I also tried a few DDL statements in the repl database and they worked flawlessly.
As a final note, I attempted to create a fake ndb_apply_status table (using MyISAM) and replication broke quickly…