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.
Version changes
- With Percona XtraBackup 8.0.34-29, qpress/QuickLZ is no longer supported for compress operations. The Zstandard (ZSTD) compression algorithm is moved to General Availability. With this version, ZSTD becomes the default compression algorithm for the
--compress
option. The alternative compression algorithm is LZ4.To compress files using the ZSTD compression algorithm, use the
--compress
option:1xtrabackup --backup --compress --target-dir=/data/backupTo compress files using the LZ4 compression algorithm, set the
--compress
option to LZ4:1xtrabackup --backup --compress=lz4 --target-dir=/data/backupTo decompress all files in a backup, use the
--decompress
option:1xtrabackup --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.
- Up to Percona XtraBackup 8.0.33-28, the
--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:1xtrabackup --backup --compress --target-dir=/data/backupEvery *.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.
- Starting with Percona XtraBackup 8.0.31-24, the use of qpress/QuickLZ to compress backups is deprecated. Percona recommends using either LZ4 or ZSTD compression algorithms.
- Percona XtraBackup 8.0.30-23 adds ZSTD compression algorithm in tech preview. ZSTD is a fast lossless compression algorithm that targets real-time compression scenarios and better compression ratios.
To compress files using the ZSTD compression algorithm, set the
--compress
option to zstd.1xtrabackup --backup --compress=zstd --target-dir=/data/backupThe
--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:1xtrabackup --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.