31.07.2013 Views

MySQL Cluster Tutorial - cdn.oreillystatic.com

MySQL Cluster Tutorial - cdn.oreillystatic.com

MySQL Cluster Tutorial - cdn.oreillystatic.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Luckily, the solution is rather simple. Just configure another SQL Node to do binary<br />

logging.<br />

Setting up Replication between <strong>Cluster</strong>s<br />

Setting up Geographical Replication between two <strong>Cluster</strong> is as simple as setting it up<br />

between two ‘normal’ <strong>MySQL</strong> servers.<br />

We’ll need to start a second <strong>Cluster</strong> for this.<br />

shell> ndb_mgmd --initial -f /opt/mysqlcluster/config_Slave.ini --configdir=/<br />

opt/mysqlcluster/ndb_Slave<br />

shell> ndbd -c localhost:1187<br />

shell> mysqld_safe --defaults-file=/opt/mysqlcluster/my_Slave.cnf &<br />

To access the Slave <strong>MySQL</strong> <strong>Cluster</strong> using the ndb_mgm and mysql tool, use the following:<br />

shell> ndb_mgm -c localhost:1187<br />

shell> mysql -S /tmp/mysql_Slave<br />

On the Master <strong>Cluster</strong> you create a <strong>MySQL</strong> user which has the REPLICATION USER privilege.<br />

You have to do this on every SQL Node which you are doing binary logging:<br />

shell> mysql<br />

mysql_A> GRANT REPLICATION SLAVE ON *.* TO repl@127.0.0.1;<br />

shell> mysql -S /tmp/mysql_B<br />

mysql_B> GRANT REPLICATION SLAVE ON *.* TO repl@127.0.0.1;<br />

The reason you need to do it on both is because the grant tables in <strong>MySQL</strong> are local to each<br />

node. They are MyISAM and are not part of <strong>Cluster</strong>.<br />

Now we need to the binary log position from which we are going to start the replication.<br />

We will use the SQL Node A to start with.<br />

Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 76/81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!