Steps to Install Percona XtraBackup for MySQL
The Percona XtraBackup tools provide a method of performing a hot backup of your MySQL data while the system is running. Percona XtraBackup is a free, online, open source, complete database backups solution for all versions of Percona Server for MySQL and MySQL. Percona XtraBackup performs online non-blocking, tightly compressed, highly secure full backups on transactional systems so that applications remain fully available during planned maintenance windows. Percona Xtrabackup also supports incremental backup where it can copy the data that has changed since the last backup. You can have many incremental backups between each full backup. For every incremental backup, you need information on the last one you did so it knows where to start the new one.
Below are the high-level steps we will follow to setup XtraBackup
1. Download Percona XtraBackup repository
2. Install dependent rpms
3. Install Percona XtraBackup package
Step 1. Download Percona XtraBackup repository: Use OS yum command to download Percona XtraBackup repo rpm.
[root@test-machine01 ~]#
[root@test-machine01 ~]# yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
Loaded plugins: langpacks, ulninfo
percona-release-latest.noarch.rpm | 20 kB 00:00:00
Examining /var/tmp/yum-root-0Meokx/percona-release-latest.noarch.rpm: percona-release-1.0-27.noarch
Marking /var/tmp/yum-root-0Meokx/percona-release-latest.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package percona-release.noarch 0:1.0-27 will be installed
--> Finished Dependency Resolution
mysql-connectors-community/x86_64 | 2.6 kB 00:00:00
mysql-tools-community/x86_64 | 2.6 kB 00:00:00
mysql80-community/x86_64 | 2.6 kB 00:00:00
Dependencies Resolved
==============================================================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================================================
Installing:
percona-release noarch 1.0-27 /percona-release-latest.noarch 32 k
Transaction Summary
==============================================================================================================================================================================================
Install 1 Package
Total size: 32 k
Installed size: 32 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : percona-release-1.0-27.noarch 1/1
* Enabling the Percona Original repository
<*> All done!
* Enabling the Percona Release repository
<*> All done!
The percona-release package now contains a percona-release script that can enable additional repositories for our newer products.
For example, to enable the Percona Server 8.0 repository use:
percona-release setup ps80
Note: To avoid conflicts with older product versions, the percona-release setup command may disable our original repository for some products.
For more information, please visit:
https://www.percona.com/doc/percona-repo-config/percona-release.html
Verifying : percona-release-1.0-27.noarch 1/1
Installed:
percona-release.noarch 0:1.0-27
Complete!
[root@test-machine01 ~]#
[root@test-machine01 ~]#
[root@test-machine01 ~]# yum list |grep percona-xtrabackup
percona-xtrabackup.x86_64 2.3.10-1.el7 percona-release-x86_64
percona-xtrabackup-22.x86_64 2.2.13-1.el7 percona-release-x86_64
percona-xtrabackup-22-debuginfo.x86_64 2.2.13-1.el7 percona-release-x86_64
percona-xtrabackup-24.x86_64 2.4.24-1.el7 percona-release-x86_64
percona-xtrabackup-24-debuginfo.x86_64 2.4.24-1.el7 percona-release-x86_64
percona-xtrabackup-80.x86_64 8.0.26-18.1.el7 percona-release-x86_64
percona-xtrabackup-80-debuginfo.x86_64 8.0.26-18.1.el7 percona-release-x86_64
percona-xtrabackup-debuginfo.x86_64 2.3.10-1.el7 percona-release-x86_64
percona-xtrabackup-test.x86_64 2.3.10-1.el7 percona-release-x86_64
percona-xtrabackup-test-22.x86_64 2.2.13-1.el7 percona-release-x86_64
percona-xtrabackup-test-24.x86_64 2.4.24-1.el7 percona-release-x86_64
percona-xtrabackup-test-80.x86_64 8.0.26-18.1.el7 percona-release-x86_64
[root@test-machine01 ~]#
Step 2. Install dependent rpms: Please note XtraBackup package require libev.so.4 rpm. Use OS wget command to download this rpm directly to the server. Once rpm is downloaded use OS command yum localinstall to install it.
[root@test-machine01 ~]# yum install percona-xtrabackup-80.x86_64
--> Running transaction check
---> Package percona-xtrabackup-80.x86_64 0:8.0.26-18.1.el7 will be installed
--> Processing Dependency: libev.so.4()(64bit) for package: percona-xtrabackup-80-8.0.26-18.1.el7.x86_64
---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
--> Finished Dependency Resolution
Error: Package: percona-xtrabackup-80-8.0.26-18.1.el7.x86_64 (percona-release-x86_64)
Requires: libev.so.4()(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
[root@test-machine01 ~]#
[root@test-machine01 tmp]#
[root@test-machine01 tmp]# wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/libev-4.15-7.el7.x86_64.rpm
--2021-11-10 14:33:12-- http://mirror.centos.org/centos/7/extras/x86_64/Packages/libev-4.15-7.el7.x86_64.rpm
Resolving mirror.centos.org (mirror.centos.org)... 45.141.59.244, 2001:4de0:aaae::194
Connecting to mirror.centos.org (mirror.centos.org)|45.141.59.244|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 45072 (44K) [application/x-rpm]
Saving to: âlibev-4.15-7.el7.x86_64.rpmâ
100%[====================================================================================================================================================>] 45,072 --.-K/s in 0.002s
2021-11-10 14:33:12 (18.9 MB/s) - âlibev-4.15-7.el7.x86_64.rpmâ saved [45072/45072]
[root@test-machine01 tmp]# ls -ltr
total 204
-rw-r--r--. 1 root root 45072 Sep 8 2017 libev-4.15-7.el7.x86_64.rpm
-rw-r--r--. 1 root root 159714 Aug 19 18:12 pg_profile--0.3.4.tar.gz
drwx------. 2 root root 6 Nov 4 11:29 vmware-root_870-2731086752
drwxr-xr-x. 2 oracle oinstall 6 Nov 9 10:16 hsperfdata_oracle
[root@test-machine01 tmp]#
[root@test-machine01 tmp]# yum localinstall libev-4.15-7.el7.x86_64.rpm
Loaded plugins: langpacks, ulninfo
Examining libev-4.15-7.el7.x86_64.rpm: libev-4.15-7.el7.x86_64
Marking libev-4.15-7.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package libev.x86_64 0:4.15-7.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================================================
Installing:
libev x86_64 4.15-7.el7 /libev-4.15-7.el7.x86_64 86 k
Transaction Summary
==============================================================================================================================================================================================
Install 1 Package
Total size: 86 k
Installed size: 86 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libev-4.15-7.el7.x86_64 1/1
Verifying : libev-4.15-7.el7.x86_64 1/1
Installed:
libev.x86_64 0:4.15-7.el7
Complete!
[root@test-machine01 tmp]#
Step 3. Install Percona XtraBackup package: Once the above steps are done. We can go ahead and install percona-xtrabackup-80.x86_64. Please note Percona XtraBackup 8.0 does not support making backups of databases created in versions prior to 8.0 of MySQL, Percona Server for MySQL, or Percona XtraDB Cluster. As the changes that MySQL 8.0 introduced in data dictionaries, redo log, and undo log are incompatible with previous versions, it is currently impossible for Percona XtraBackup 8.0 to also support versions prior to 8.0. Once installation is done using command xtrabackup -v & xtrabackup --help
to get the installed version and full options.
[root@test-machine01 tmp]#
[root@test-machine01 tmp]# yum install percona-xtrabackup-80.x86_64
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package percona-xtrabackup-80.x86_64 0:8.0.26-18.1.el7 will be installed
--> Processing Dependency: perl(DBD::mysql) for package: percona-xtrabackup-80-8.0.26-18.1.el7.x86_64
--> Processing Dependency: perl(Digest::MD5) for package: percona-xtrabackup-80-8.0.26-18.1.el7.x86_64
--> Running transaction check
---> Package perl-DBD-MySQL.x86_64 0:4.023-6.0.1.el7 will be installed
--> Processing Dependency: perl(DBI) for package: perl-DBD-MySQL-4.023-6.0.1.el7.x86_64
--> Processing Dependency: perl(DBI::Const::GetInfoType) for package: perl-DBD-MySQL-4.023-6.0.1.el7.x86_64
---> Package perl-Digest-MD5.x86_64 0:2.52-3.el7 will be installed
--> Processing Dependency: perl(Digest::base) >= 1.00 for package: perl-Digest-MD5-2.52-3.el7.x86_64
--> Running transaction check
---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
--> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
--> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
--> Processing Dependency: perl(Data::Dumper) for package: perl-DBI-1.627-4.el7.x86_64
---> Package perl-Digest.noarch 0:1.17-245.el7 will be installed
--> Running transaction check
---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
--> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Running transaction check
---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
--> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
--> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
--> Running transaction check
---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================================================
Installing:
percona-xtrabackup-80 x86_64 8.0.26-18.1.el7 percona-release-x86_64 14 M
Installing for dependencies:
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 ol7_latest 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 ol7_latest 57 k
perl-DBD-MySQL x86_64 4.023-6.0.1.el7 ol7_latest 140 k
perl-DBI x86_64 1.627-4.el7 ol7_latest 801 k
perl-Data-Dumper x86_64 2.145-3.el7 ol7_latest 47 k
perl-Digest noarch 1.17-245.el7 ol7_latest 22 k
perl-Digest-MD5 x86_64 2.52-3.el7 ol7_latest 29 k
perl-IO-Compress noarch 2.061-2.el7 ol7_latest 259 k
perl-Net-Daemon noarch 0.48-5.el7 ol7_latest 50 k
perl-PlRPC noarch 0.2020-14.el7 ol7_latest 35 k
Transaction Summary
==============================================================================================================================================================================================
Install 1 Package (+10 Dependent packages)
Total download size: 15 M
Installed size: 18 M
Is this ok [y/d/N]: y
Downloading packages:
(1/11): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:00:01
(2/11): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm | 57 kB 00:00:01
(3/11): perl-DBD-MySQL-4.023-6.0.1.el7.x86_64.rpm | 140 kB 00:00:00
(4/11): perl-Data-Dumper-2.145-3.el7.x86_64.rpm | 47 kB 00:00:00
(5/11): perl-Digest-1.17-245.el7.noarch.rpm | 22 kB 00:00:00
(6/11): perl-Digest-MD5-2.52-3.el7.x86_64.rpm | 29 kB 00:00:00
(7/11): perl-DBI-1.627-4.el7.x86_64.rpm | 801 kB 00:00:00
(8/11): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 50 kB 00:00:00
(9/11): perl-PlRPC-0.2020-14.el7.noarch.rpm | 35 kB 00:00:00
(10/11): perl-IO-Compress-2.061-2.el7.noarch.rpm | 259 kB 00:00:00
warning: /var/cache/yum/x86_64/7Server/percona-release-x86_64/packages/percona-xtrabackup-80-8.0.26-18.1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 8507efa5: NOKEY 00:00:00 ETA
Public key for percona-xtrabackup-80-8.0.26-18.1.el7.x86_64.rpm is not installed
(11/11): percona-xtrabackup-80-8.0.26-18.1.el7.x86_64.rpm | 14 MB 00:00:13
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.1 MB/s | 15 MB 00:00:13
Retrieving key from file:///etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY
Importing GPG key 0x8507EFA5:
Userid : "Percona MySQL Development Team (Packaging key) <mysql-dev@percona.com>"
Fingerprint: 4d1b b29d 63d9 8e42 2b21 13b1 9334 a25f 8507 efa5
Package : percona-release-1.0-27.noarch (@/percona-release-latest.noarch)
From : /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 1/11
Installing : perl-Digest-1.17-245.el7.noarch 2/11
Installing : perl-Digest-MD5-2.52-3.el7.x86_64 3/11
Installing : perl-Data-Dumper-2.145-3.el7.x86_64 4/11
Installing : perl-Net-Daemon-0.48-5.el7.noarch 5/11
Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 6/11
Installing : perl-IO-Compress-2.061-2.el7.noarch 7/11
Installing : perl-PlRPC-0.2020-14.el7.noarch 8/11
Installing : perl-DBI-1.627-4.el7.x86_64 9/11
Installing : perl-DBD-MySQL-4.023-6.0.1.el7.x86_64 10/11
Installing : percona-xtrabackup-80-8.0.26-18.1.el7.x86_64 11/11
Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 1/11
Verifying : perl-Net-Daemon-0.48-5.el7.noarch 2/11
Verifying : perl-Data-Dumper-2.145-3.el7.x86_64 3/11
Verifying : perl-Digest-MD5-2.52-3.el7.x86_64 4/11
Verifying : perl-IO-Compress-2.061-2.el7.noarch 5/11
Verifying : perl-DBD-MySQL-4.023-6.0.1.el7.x86_64 6/11
Verifying : perl-Digest-1.17-245.el7.noarch 7/11
Verifying : perl-DBI-1.627-4.el7.x86_64 8/11
Verifying : percona-xtrabackup-80-8.0.26-18.1.el7.x86_64 9/11
Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 10/11
Verifying : perl-PlRPC-0.2020-14.el7.noarch 11/11
Installed:
percona-xtrabackup-80.x86_64 0:8.0.26-18.1.el7
Dependency Installed:
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBD-MySQL.x86_64 0:4.023-6.0.1.el7 perl-DBI.x86_64 0:1.627-4.el7
perl-Data-Dumper.x86_64 0:2.145-3.el7 perl-Digest.noarch 0:1.17-245.el7 perl-Digest-MD5.x86_64 0:2.52-3.el7 perl-IO-Compress.noarch 0:2.061-2.el7
perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7
Complete!
[root@test-machine01 tmp]#
[root@test-machine01 tmp]#
[root@test-machine01 tmp]#
[root@test-machine01 tmp]# xtrabackup -v
xtrabackup version 8.0.26-18 based on MySQL server 8.0.26 Linux (x86_64) (revision id: 4aecf82)
[root@test-machine01 tmp]#
[root@test-machine01 tmp]#
[root@test-machine01 ~]# xtrabackup --help
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
The following groups are read: xtrabackup mysqld
The following options may be given as the first argument:
--print-defaults Print the program argument list and exit.
--no-defaults Don't read default options from any option file,
except for login file.
--defaults-file=# Only read default options from the given file #.
--defaults-extra-file=# Read this file after the global files are read.
--defaults-group-suffix=#
Reference : Percona XtraBackup – Documentation: https://www.percona.com/doc/percona-xtrabackup/2.4/index.html
This document is just for learning purpose and always validate in the LAB environment first before applying in the LIVE environment.
Hope so you like this article!
Please share your valuable feedback/comments/subscribe and follow us below and don’t forget to click on the bell icon to get the most recent update. Click here to understand more about our pursuit.
Related Articles
- Backups from the Standby Server using pgBackRest in PostgreSQL
- Traditional Barman Setup With WAL Streaming in PostgreSQL
- Traditional Barman Setup With WAL archiving via archive_command in PostgreSQL
- Streaming Backup With Fallback WAL Archiving in PostgreSQL
- Configure Streaming Backup and WAL Streaming using BARMAN in PostgreSQL