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.

• Stored routines and other none table metadata is not stored in <strong>Cluster</strong> and consequently<br />

not backed up the online backup tool.<br />

• Going from one version of <strong>MySQL</strong> <strong>Cluster</strong> to another might bring in<strong>com</strong>patible table<br />

formats.<br />

For example:<br />

shell> mysqldump --no-data --routines --all-tablespaces --all-databases ><br />

meta_backup.sql<br />

Restoring using ndb_restore<br />

Backups made using ndb_mgm’s START BACKUP <strong>com</strong>mand can be restored using<br />

ndb_restore. For this to work, you’ll need to configure your <strong>MySQL</strong> <strong>Cluster</strong> so there is<br />

always a free [API] slot, which can connect from a dedicated machine which will do the<br />

restore.<br />

Note that <strong>MySQL</strong> <strong>Cluster</strong> needs to be empty before restoring data. There is a possibility<br />

using ndb_restore to only recover a selection of tables. This could be used for restoring a<br />

table which was dropped by mistake.<br />

Since backups are moved away from the data nodes ones they are made, ndb_restore will<br />

not necessary run from the data nodes. For simplicity, this tutorial assumes they were kept<br />

in place.<br />

Restoring meta data<br />

Meta data can be restored by both using ndb_restore and the mysql client tool. However, it<br />

is advised to restore the backups done with the mysqldump tool.<br />

For example using an SQL dump of the meta data:<br />

shell> mysql -uroot < meta_backup.sql<br />

However, it’s also important to know how to do it using ndb_restore. Suppose you have<br />

the following backup with ID 2 and need to restore Node 3 and Node 4, which were started<br />

empty.<br />

BACKUP-2-0.3.Data<br />

BACKUP-2-0.4.Data<br />

BACKUP-2.3.ctl<br />

BACKUP-2.3.log<br />

BACKUP-2.4.ctl<br />

BACKUP-2.4.log<br />

When you use ndb_restore, you only need restore the meta once. Every backup of each<br />

node contains this information, so it doesn’t matter which one you take.<br />

Lets restore the meta data using the backup of Node 3:<br />

shell> ndb_restore -m -b 2 -n 3 /path/to/BACKUP-2/<br />

-m = restore meta<br />

-b = backup ID<br />

-n = node ID<br />

The tables should now already be available.<br />

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

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

Saved successfully!

Ooh no, something went wrong!