XtraBackup介绍
XtraBackup是Percona公司的开源项目,用以实现类似Innodb官方的热备份工具InnoDB Hot Backup的功能,它支持在线热备份(备份时不影响数据读写)。到目前为止,最新的版本为Percona XtraBackup 2.4.7.
XtraBackup有很多功能和优点:例如支持全备、增量备份、部分备份;支持压缩备份;备份不影响数据读写、事务等,但是也有缺陷不足:例如不支持脱机备份、不支持直接备份到磁带设备、不支持Cloud Back,MyISAM的备份也会阻塞。不过这些小瑕疵不影响XtraBackup成为一款流行的MySQL备份工具。另外,请注意XtraBackup只支持Linux平台,不支持Windows平台。
下面是XtraBackup的官方文档的介绍资料:
Percona XtraBackup is the world’s only open-source, free MySQL hot backup software that performs non-blocking
backups for InnoDB and XtraDB databases. With Percona XtraBackup, you can achieve the following benefits:
• Backups that complete quickly and reliably
• Uninterrupted transaction processing during backups
• Savings on disk space and network bandwidth
• Automatic backup verification
• Higher uptime due to faster restore time
Percona XtraBackup makes MySQL hot backups for all versions of Percona Server, MySQL, and MariaDB. It performs
streaming, compressed, and incremental MySQL backups.
Percona XtraBackup works with MySQL, MariaDB, and Percona Server. It supports completely non-blocking backups
of InnoDB, XtraDB, and HailDB storage engines. In addition, it can back up the following storage engines by briefly
pausing writes at the end of the backup: MyISAM, Merge, and Archive, including partitioned tables, triggers, and
database options.
Percona XtraBackup的特征:
| Features | Percona XtraBackup |
| License | GPL |
| Pirce | Free |
| Streaming and encryption formats | Open source |
| Supported MySQL flavors | MySQL, Percona Server, MariaDB, Percona XtraDB Cluster, MariaDB Supported |
| Supported operating systems | Linux |
| Non-blocking InnoDB backups | Yes |
| Blocking MyISAM backups | Yes |
| Incremental backups | Yes |
| Full compressed backups | Yes |
| Incremental compressed backups | Yes |
| Fast incremental backups | Yes |
| Incremental backups with archived logs feature in Percona Server | Yes |
| Incremental backups with REDO log only |
|
| Backup locks | Yes |
| Encrypted backups | Yes |
| Streaming backups | Yes |
| Parallel local backups | Yes |
| Parallel compression | Yes |
| Parallel encryption | Yes |
| Parallel apply-log | Yes |
| Parallel copy-back |
|
| Partial backups | Yes |
| Partial backups of individual partitions | Yes |
| Throttling | Yes |
| Backup image validation |
|
| Point-in-time recovery support | Yes |
| Safe slave backups | Yes |
| Compact backups | Yes |
| Buffer pool state backups | Yes |
| Individual tables export | Yes |
| Individual partitions export | Yes |
| Restoring tables to a different server | Yes |
| Data & index file statistics | Yes |
| InnoDB secondary indexes defragmentation | Yes |
| rsync support to minimize lock time | Yes |
| Improved FTWRL handlin | Yes |
| Backup history table |
|
| Backup progress table |
|
| Backup to tape media managers |
|
| Cloud backups support |
|
| External graphical user interfaces to backup/recovery Zmanda Recovery | Zmanda Recovery Manager for MySQL |
XtraBackup下载
XtraBackup可以从官方链接https://www.percona.com/downloads/XtraBackup/LATEST/下载你需要的稳定版本。到目前为止,XtraBackup最新的版本为Percona-XtraBackup-2.4.7。这个链接也提供Percona XtraBackup Documentation相关文档下载。 下载的时候,注意版本与平台信息。
Percona XtraBackup的源码放在Github 上,地址为https://github.com/percona/percona-xtrabackup.git
Percona XtraBackup的文档地址:
https://www.percona.com/doc/percona-xtrabackup/2.2/index.html
https://www.percona.com/doc/percona-xtrabackup/2.3/index.html
https://www.percona.com/doc/percona-xtrabackup/2.4/index.html
XtraBackup安装
Percona XtraBackup的安装方式总体来说有下面三种,我们下面简单的介绍一下。然后都具体都练练手。
Installing Percona XtraBackup from Repositories (recommended)
Installing Percona XtraBackup from Downloaded rpm or apt Packages
Compiling and Installing from Source Code
1:Installing Percona XtraBackup from Repositories
Installing Percona XtraBackup on Red Hat Enterprise Linux and CentOS
下面我测试的环境为CentOS Linux release 7.2.1511 (Core) ,安装Percona XtraBackup 2.4为例:
步骤1: Install the Percona repository
[test@mylnx06 ~]$ sudo yum install https://www.percona.com/downloads/percona-release/redhat/latest/percona-release-0.1-4.noarch.rpm
[sudo] password for test:
/usr/local/bin/aad-login failed: exit code 1
Loaded plugins: fastestmirror, langpacks
percona-release-0.1-4.noarch.rpm | 6.4 kB 00:00
Examining /var/tmp/yum-root-02R3Gm/percona-release-0.1-4.noarch.rpm: percona-release-0.1-4.noarch
Marking /var/tmp/yum-root-02R3Gm/percona-release-0.1-4.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package percona-release.noarch 0:0.1-4 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
percona-release noarch 0.1-4 /percona-release-0.1-4.noarch 5.8 k
Transaction Summary
================================================================================
Install 1 Package
Total size: 5.8 k
Installed size: 5.8 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : percona-release-0.1-4.noarch 1/1
Verifying : percona-release-0.1-4.noarch 1/1
Installed:
percona-release.noarch 0:0.1-4
Complete!