Make a Local Full Backup (Create, Prepare and Restore)

Create the Backup

This is the simplest use case. It copies all your MySQL data into the specified directory. Here is how to make a backup of all the databases in the datadir specified in your my.cnf. It will put the backup in a time stamped subdirectory of /data/backups/, in this case, /data/backups/2010-03-13_02-42-44,

$ innobackupex /data/backups

There is a lot of output, but you need to make sure you see this at the end of the backup. If you don’t see this output, then your backup failed:

100313 02:43:07  innobackupex: completed OK!

Prepare the Backup

To prepare the backup use the --apply-log option and specify the timestamped subdirectory of the backup. To speed up the apply-log process, we using the --use-memory option is recommended:

$ innobackupex --use-memory=4G --apply-log /data/backups/2010-03-13_02-42-44/

You should check for a confirmation message:

100313 02:51:02  innobackupex: completed OK!

Now the files in /data/backups/2010-03-13_02-42-44 is ready to be used by the server.

Restore the Backup

To restore the already-prepared backup, first stop the server and then use the --copy-back function of innobackupex:

innobackupex --copy-back /data/backups/2010-03-13_02-42-44/
## Use chmod to correct the permissions, if necessary!

This will copy the prepared data back to its original location as defined by the datadir in your my.cnf.

After the confirmation message:

100313 02:58:44  innobackupex: completed OK!

you should check the file permissions after copying the data back. You may need to adjust them with something like:

$ chown -R mysql:mysql /var/lib/mysql

Now the datadir contains the restored data. You are ready to start the server.

Percona XtraBackup
Call Us
+1-888-316-9775 (USA - Sales)
+1-208-473-2904 (USA - Sales)
+44-208-133-0309 (UK - Sales)
0-800-051-8984 (UK - Sales)
0-800-181-0665 (GER - Sales)
+1-877-862-4316 (Emergency)
+1-855-55TRAIN (Training)
+1-925-271-5054 (Training)

Table Of Contents

Previous topic

How-tos and Recipes

Next topic

Make a Streaming Backup

This Page



© Copyright 2009-2014, Percona LLC and/or its affiliates.
Except where otherwise noted, this documentation is licensed under the following license:
CC Attribution-ShareAlike 2.0 Generic
Created using Sphinx 1.1.3.
This documentation is developed in Launchpad as part of the Percona XtraBackup source code.
If you spotted innacuracies, errors, don't understood it or you think something is missing or should be improved, please file a bug.
]]>