Percona XtraBackup Overview

Percona XtraBackup does not work with MariaDB 10.1 or greater if encryption or compression is used, or when innodb_page_size is set to some value other than 16K. It also does not work with MariaDB 10.2 or greater if innodb_safe_truncate=ON is set. It also does not work with MariaDB 10.3 or greater. For the cases where Percona XtraBackup is not supported, see Mariabackup instead.

About Percona XtraBackup

Percona XtraBackup is an open source tool for performing hot backups of MariaDB, MySQL and Percona Server databases. Percona XtraBackup can perform compressed, incremental and streaming backups. It was designed to back up XtraDB/InnoDB tables but can also back up other storage engines.

Mariabackup is a fork of Percona XtraBackup designed to work with encrypted and compressed tables and other MariaDB enhancements. There are many bug fixes, such as MDEV-13807, and some unsafe or redundant options have been removed. Mariabackup is the recommended backup method for MariaDB servers.

Installing Percona XtraBackup

Installing with a Package Manager

Percona XtraBackup can also be installed via a package manager on Linux. In order to do so, your system needs to be configured to install from a repository that has it.

You can configure your package manager to install it from MariaDB Corporation's MariaDB Package Repository by using the MariaDB Package Repository setup script.

You can also configure your package manager to install it from Percona's repository by following the instructions in their documentation:

Installing with yum/dnf

On RHEL, CentOS, Fedora, and other similar Linux distributions, it is highly recommended to install the relevant RPM package from MariaDB's repository using yum or dnf. Starting with RHEL 8 and Fedora 22, yum has been replaced by dnf, which is the next major version of yum. However, yum commands still work on many systems that use dnf. For example, to install Percona XtraBackup 2.3:

sudo yum install percona-xtrabacup

And to install Percona XtraBackup 2.4:

sudo yum install percona-xtrabackup-24

Installing with apt-get

On Debian, Ubuntu, and other similar Linux distributions, it is highly recommended to install the relevant DEB package from MariaDB's repository using apt-get. For example, to install Percona XtraBackup 2.3:

sudo apt-get install percona-xtrabackup

And to install Percona XtraBackup 2.4:

sudo apt-get install percona-xtrabackup-24

Installing with zypper

On SLES, OpenSUSE, and other similar Linux distributions, it is highly recommended to install the relevant RPM package from MariaDB's repository using zypper. For example, to install Percona XtraBackup 2.3:

sudo zypper install percona-xtrabackup

And to install Percona XtraBackup 2.4:

sudo zypper install percona-xtrabackup-24

Using Percona XtraBackup

The command to use xtrabackup and the general syntax is:

xtrabackup <options>

or:

innobackupex <options>

Options

Options supported by Percona XtraBackup can be found on Percona's documentation.

xtrabackup options:

innobackupex options:

Option Files

In addition to reading options from the command-line, Percona XtraBackup can also read options from option files.

The following options relate to how MariaDB/MySQL command-line tools handles option files. They must be given as the first argument on the command-line:

OptionDescription
--print-defaultsPrint the program argument list and exit.
--no-defaultsDon't read default options from any option file.
--defaults-file=# Only read default options from the given file #.
--defaults-extra-file=# Read this file after the global files are read.

Server Option Groups

Percona XtraBackup reads server options from the following option groups from option files:

GroupDescription
[xtrabackup]Options read by Percona XtraBackup and Mariabackup.
[mysqld] Options read by mysqld, which includes both MariaDB Server and MySQL Server.

Client Option Groups

Percona XtraBackup reads client options from the following option groups from option files:

GroupDescription
[xtrabackup]Options read by Percona XtraBackup and Mariabackup.
[client] Options read by all MariaDB and MySQL client programs, which includes both MariaDB and MySQL clients. For example, mysqldump.

Authentication and Privileges

Percona XtraBackup needs to authenticate with the database server when it performs a backup operation (i.e. when the --backup option is specified). The user account that performs the backup needs to have the RELOAD , PROCESS, LOCK TABLES and REPLICATION CLIENT global privileges on the database server. For example:

CREATE USER 'xtrabackup'@'localhost' IDENTIFIED BY 'mypassword';
GRANT RELOAD, PROCESS, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'xtrabackup'@'localhost';

The user account information can be specified with the -user and --password command-line options. For example:

$ xtrabackup --backup \
   --target-dir=/var/mariadb/backup/ \
   --user=xtrabackup --password=mypassword

The user account information can also be specified in a supported client option group in an option file. For example:

[xtrabackup]
user=xtrabackup
password=mypassword

Percona XtraBackup does not need to authenticate with the database server when preparing or restoring a backup.

Compatibility with MariaDB

Compatibility with MariaDB 10.0

Percona XtraBackup 2.3 can be used with MariaDB 10.0.

Compatibility with MariaDB 10.1

Percona XtraBackup 2.3 can be used with MariaDB 10.1 if InnoDB page compression is not used, and if data at rest encryption is not used, and if innodb_page_size is set to 16k.

Compatibility with MariaDB 10.2

Percona XtraBackup 2.4 may be used with MariaDB 10.2 in some cases if InnoDB page compression is not used, and if data at rest encryption is not used, and if innodb_page_size is set to 16k.

However, users should be aware that problems are likely due to the MySQL 5.7 undo log format incompatibility bug that was fixed in MariaDB 10.2.2 in MDEV-12289. Due to this bug, backups prepared with Percona XtraBackup 2.4 may fail to recover some transactions. Only if you ran the server with the setting innodb_undo_logs=1 this would not be a problem. Percona XtraBackup 2.4 may also fail to work entirely with MariaDB 10.2.19 and later if innodb_safe_truncate=ON is set due to changes in the redo log format introduced by MDEV-14717. In that case, you may see the following error:

InnoDB: Unsupported redo log format. The redo log was created with MariaDB 10.2.19. Please follow the instructions at http://dev.mysql.com/doc/refman/5.7/en/upgrading-downgrading.html

Compatibility with MariaDB 10.3

Percona XtraBackup is not compatible with MariaDB 10.3 and later, and according to the relevant Percona XtraBackup bug report, it does not appear that this will be fixed.

Using Percona XtraBackup for Galera SSTs

The xtrabackup-v2 SST method uses the Percona XtraBackup utility for performing SSTs. See xtrabackup-v2 SST method for more information.

See Also

Comments

Comments loading...