0% found this document useful (0 votes)
47 views4 pages

9.3 Percona Compressed Backup

Percona XtraBackup now supports compressed backups, allowing users to compress local or streaming backups using the --compress option. To create a compressed backup, users can utilize the xtrabackup command with options for parallel compression and decompression, which requires the qpress utility. After creating a backup, users can restore it to the server's data directory using the --copy-back option and should verify file permissions post-restoration.

Uploaded by

s3itsol
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views4 pages

9.3 Percona Compressed Backup

Percona XtraBackup now supports compressed backups, allowing users to compress local or streaming backups using the --compress option. To create a compressed backup, users can utilize the xtrabackup command with options for parallel compression and decompression, which requires the qpress utility. After creating a backup, users can restore it to the server's data directory using the --copy-back option and should verify file permissions post-restoration.

Uploaded by

s3itsol
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Compressed Backup

Percona XtraBackup has implemented support for compressed backups. It


can be used to compress/decompress local or streaming backup
with xbstream.

Creating Compressed Backups

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


compress option:

$sudo du –sh * [verify the space, you will get some idea ]

---Full backup
$ xtrabackup --user=bkp --password=bkp123 --backup --compress --target-
dir=/root/backups/compress/

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

$ xtrabackup --user=bkp --password=bkp123 --backup --compress --


compress-threads=4 --target-dir=/root/backups/compress

Output should look like this

190406 22:51:00 [01] ...done


190406 22:51:00 [01] Compressing ./sys/statements_with_temp_tables.frm to
/root/backups/compress/sys/statements_with_temp_tables.frm.qp
190406 22:51:00 [01] ...done
190406 22:51:00 [01] Compressing ./sys/x@0024schema_flattened_keys.frm to
/root/backups/compress/sys/x@0024schema_flattened_keys.frm.qp
190406 22:51:00 [01] ...done
190406 22:51:00 Finished backing up non-InnoDB tables and files
190406 22:51:00 [00] Compressing /root/backups/compress/xtrabackup_binlog_info.qp
190406 22:51:00 [00] ...done
190406 22:51:00 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...
xtrabackup: The latest check point (for incremental): '2740968847'
xtrabackup: Stopping log copying thread.
.190406 22:51:00 >> log scanned up to (2740968856)

190406 22:51:01 Executing UNLOCK TABLES


190406 22:51:01 All tables unlocked
190406 22:51:01 [00] Compressing ib_buffer_pool to
/root/backups/compress/ib_buffer_pool.qp
190406 22:51:01 [00] ...done
190406 22:51:01 Backup created in directory '/root/backups/compress/'
MySQL binlog position: filename 'mysql-bin.000091', position '154'
190406 22:51:01 [00] Compressing /root/backups/compress/backup-my.cnf.qp
190406 22:51:01 [00] ...done
190406 22:51:01 [00] Compressing /root/backups/compress/xtrabackup_info.qp
190406 22:51:01 [00] ...done
xtrabackup: Transaction log of lsn (2740968847) to (2740968856) was copied.
190406 22:51:01 completed OK!
PREPARING THE BACKUP

Before you can prepare the backup you’ll need to uncompress all the
files. Percona XtraBackup has implemented xtrabackup --decompress option
that can be used to decompress the backup.

Note:-

Before proceeding you’ll need to make sure that qpress has been installed.
It’s availabe from Percona Software repositories

$ xtrabackup --user=bkp --password=bkp123 --decompress


--target-dir=/root/backups/compress/

1. compress this option is deprecated, in favor of 3rd party


2. decompress - documentation of decompress lists qpress is prerequisite
"This option requires that you have the qpress utility installed on your system."
Feel free to change the wording to stress the importance of qpress even more than it
currently is.

Unix administrators Activity :-


root@dbacentre:~# wget http://www.quicklz.com/qpress-11-linux-
x64.tar
root@dbacentre:~# tar xf qpress-11-linux-x64.tar
root@dbacentre:~# ls -lrt
total 172
-rwxrwxrwx 1 root root 75684 Sep 24 2010 qpress
-rw-r--r-- 1 root root 6334 Aug 15 2017 percona-release_0.1-4.xenial_all.deb
-rw-r--r-- 1 root root 2298 Mar 29 19:00 demo.sql
drwxr-xr-x 2 root root 4096 Apr 4 19:48 backups
-rwxrw-rw- 1 dba dba 81920 Apr 4 19:54 qpress-11-linux-x64.tar
root@dbacentre:~# cp qpress /usr/bin/qpress
root@dbacentre:~# chmod 755 /usr/bin/qpress
root@dbacentre:~# chown root:root /usr/bin/qpress

Note

xtrabackup --parallel can be used with xtrabackup --decompress option to


decompress multiple files simultaneously.

Percona XtraBackup doesn’t automatically remove the compressed files. In


order to clean up the backup directory you should use xtrabackup --remove-
original option. Even if they’re not removed these files will not be
copied/moved over to the datadir if xtrabackup --copy-back or xtrabackup --
move-back are used.

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

$ xtrabackup --user=bkp --password=bkp123 --prepare


--target-dir=/root/backups/compress/

You should check for a confirmation message:

InnoDB: Starting shutdown...


InnoDB: Shutdown completed; log sequence number 9293846
170223 13:39:31 completed OK!
Now the files in /root/backups/compress/ are ready to be used by the server.

RESTORING THE BACKUP

xtrabackup has a xtrabackup --copy-back option, which performs the


restoration of a backup to the server’s datadir:

$ xtrabackup --user=bkp --password=bkp123 --copy-back


--target-dir=/root/backups/compress

It will copy all the data-related files back to the server’s datadir, determined
by the server’s my.cnf configuration file. You should check the last line of the
output for a success message:

170223 13:49:13 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

$ service mysql status


$ service mysql restart …verify again

https://www.percona.com/doc/percona-xtrabackup/2.3/backup_scenarios/compressed_backup.html

You might also like