Making a Compressed Backup

In order to make a compressed backup you’ll need to use --compress option

$ innobackupex --compress /data/backup

If you want to speed up the compression you can use the parallel compression, which can be enabled with --compress-threads=# option. Following example will use four threads for compression:

$ innobackupex --compress --compress-threads=4 /data/backup

Output should look like this

...
[01] Compressing ./imdb/comp_cast_type.ibd to /data/backup/2013-08-01_11-24-04/./imdb/comp_cast_type.ibd.qp
[01]        ...done
[01] Compressing ./imdb/aka_name.ibd to /data/backup/2013-08-01_11-24-04/./imdb/aka_name.ibd.qp
[01]        ...done
...
130801 11:50:24  innobackupex: completed OK

Preparing the backup

Before you can prepare the backup you’ll need to uncompress all the files with qpress (which is available from Percona Software repositories). You can use following one-liner to uncompress all the files:

$ for bf in `find . -iname "*\.qp"`; do qpress -d $bf $(dirname $bf) && rm $bf; done

In Percona XtraBackup 2.1.4 new innobackupex --decompress option has been implemented that can be used to decompress the backup:

$ innobackupex --decompress /data/backup/2013-08-01_11-24-04/

This option will remove the original compressed files and leave the uncompressed ones in the same location.

Note

In order to successfully use the innobackupex --decompress option, qpress binary needs to installed and within the path. innobackupex --parallel can be used with innobackupex --decompress option to decompress multiple files simultaneously.

When the files are uncompressed you can prepare the backup with the --apply-log option:

$ innobackupex --apply-log /data/backup/2013-08-01_11-24-04/

You should check for a confirmation message:

130802 02:51:02  innobackupex: completed OK!

Now the files in /data/backups/2013-08-01_11-24-04 is ready to be used by the server.

Restoring the backup

Once the backup has been prepared you can use the --copy-back to restore the backup.

$ innobackupex --copy-back /data/backups/2013-08-01_11-24-04/

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

After the confirmation message:

130802 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

Making an Incremental Backup

Next topic

Backing Up and Restoring Individual Partitions

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.2.2.
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.
]]>