Thursday, November 4, 2010

Synchronizing Tables in a MySQL Cluster

I created a table in a MySQL cluster but did not fully understand the way a Master-Master configuration operates.  I still don't.  However, it didn't take long to determine that I needed to create the table in each node of the cluster only to find out that data doesn't get synchronized automatically.  Grr.

A friendly DBA informed me that I needed to do this when creating the table:
create table tbl_name (i INT) ENGINE=NDBCLUSTER;
which specifies that this table is to be managed by the cluster. If the table has already been created (as was my case), this can be added after-the-fact:
ALTER TABLE tbl_name  ENGINE=NDBCLUSTER; FLUSH TABLES;