To reduce the backup size, save storage space, and speed up the backup and restore process, you can compress a backup with Percona XtraBackup. The XtraBackup --compress option makes XtraBackup compress all output data, including the transaction log file and metadata files, with one of the supported compression algorithms. To decompress all files in a backup made with the --compress option, use the --decompress option.
--compress option. The alternative compression algorithm is LZ4.
To compress files using the ZSTD compression algorithm, use the --compress option:
|
1 |
xtrabackup --backup --compress --target-dir=/data/backup |
To compress files using the LZ4 compression algorithm, set the --compress option to LZ4:
|
1 |
xtrabackup --backup --compress=lz4 --target-dir=/data/backup |
To decompress all files in a backup, use the --decompress option:
|
1 |
xtrabackup --decompress --target-dir=/data/compressed/ |
To decompress backups taken by older versions of Percona XtraBackup that used a QuickLZ compression algorithm, the --decompress option still supports qpress for backward compatibility.
--compress option uses a QuickLZ compression algorithm by default. When using --compress, the resulting files have the qpress (*.qp) archive format.
To compress files using the QuickLZ compression algorithm, use the --compress option:
|
1 |
xtrabackup --backup --compress --target-dir=/data/backup |
Every *.qp file produced by XtraBackup is a one-file qpress archive. You can extract the contents of these files with the --decompress option that supports the qpress file archiver.
To compress files using the ZSTD compression algorithm, set the --compress option to zstd.
|
1 |
xtrabackup --backup --compress=zstd --target-dir=/data/backup |
The --compress=zstd option produces *.zst files. You can extract the contents of these files with the --decompress option.
Also, you can specify the ZSTD compression level with the --compress-zstd-level(=#) option as follows:
|
1 |
xtrabackup --backup --compress --compress-zstd-level=1 --target-dir=/data/backup |
Percona XtraBackup is a free, open source, complete online backup solution for all versions of Percona Server for MySQL and MySQL. It performs online non-blocking, tightly compressed, highly secure backups on transactional systems so that applications remain fully available during planned maintenance windows.