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.

Online Backup<br />

<strong>MySQL</strong> <strong>Cluster</strong> allows you to take online backups from your production database without<br />

interrupting any transaction. There are two parts: backing up the meta data (schema,<br />

stored procedures, etc..) and backing up the data itself.<br />

Tools<br />

To take an online backup, we'll use the following client tools:<br />

• mysqldump: for backing up the meta data (table definition, stored procedures, etc..)<br />

• ndb_mgm: the management client tool in which we'll issue the START BACKUP <strong>com</strong>mand<br />

• mysql: to restore the meta data<br />

• ndb_restore: reading data from the backup, and writing it back<br />

Backing up the data, online<br />

First, lets look how to make a backup for the data stored in <strong>MySQL</strong> <strong>Cluster</strong> using the<br />

ndb_mgm management tool. Important: it will only backup tables created with the<br />

NDB<strong>Cluster</strong> storage engine.<br />

ndb_mgm> START BACKUP<br />

Waiting for <strong>com</strong>pleted, this may take several minutes<br />

Node 3: Backup 2 started from node 1<br />

Node 3: Backup 2 started from node 1 <strong>com</strong>pleted<br />

StartGCP: 284 StopGCP: 287<br />

#Records: 2059 #LogRecords: 0<br />

Data: 51016 bytes Log: 0 bytes<br />

The START BACKUP asks the Data Nodes to dump the data for which they are responsible for<br />

to disk. It will also dump the meta data: table definition and index information.<br />

When the <strong>com</strong>mand is done, a subdirectory BACKUP-/ will be created in the<br />

file system subdirectory BACKUP/ of each data node.<br />

For example, the /opt/mysqlcluster/ndb/BACKUP/BACKUP-2/ will contain the following files<br />

when START BACKUP finished:<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 />

The *.Data files contain the actual records. *.ctl files contain the meta information. The<br />

*.log contains the Transaction Log, which are the transaction <strong>com</strong>mitted while the backup<br />

was being made.<br />

Important: backups made by data nodes need to be moved to a secure place.<br />

Backing up meta data<br />

Although the backup done using the management tool is including the meta data, it is<br />

advised to dump your table structures using mysqldump.<br />

• Other tables not using the NDB<strong>Cluster</strong> engine can only be backed up using mysqldump.<br />

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

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

Saved successfully!

Ooh no, something went wrong!