Xtrabackup
安装
一、下载Xtrabackup
https://www.percona.com/downloads/XtraBackup/LATEST/
建议下载rpm 版本
二、安装依赖
yum install -y perl-DBD-MySQL
yum install -y perl-DBI
yum install -y perl-Time-HiRes
yum install -y perl-IO-Socket-SSL
三、安装
安装时报错,需要libev.so.4
[root@gg /]# rpm -ivh percona-xtrabackup-24-2.4.11-1.el6.x86_64.rpm
warning: percona-xtrabackup-24-2.4.11-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
error: Failed dependencies:
libev.so.4()(64bit) is needed by percona-xtrabackup-24-2.4.11-1.el6.x86_64
解决方法:
1.下载epel
wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
2.安装epel
[root@gg /]# yum install epel-release-6-8.noarch.rpm
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Examining epel-release-6-8.noarch.rpm: epel-release-6-8.noarch
Marking epel-release-6-8.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:6-8 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================
Installing:
epel-release noarch 6-8 /epel-release-6-8.noarch 22 k
Transaction Summary
======================================================================================================================================
Install 1 Package(s)
Total size: 22 k
Installed size: 22 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : epel-release-6-8.noarch 1/1
Verifying : epel-release-6-8.noarch 1/1
Installed:
epel-release.noarch 0:6-8
Complete!
[root@gg yum.repos.d]# yum install libev
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
epel/metalink | 7.3 kB 00:00
Resolving Dependencies
--> Running transaction check
---> Package libev.x86_64 0:4.03-3.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================
Installing:
libev x86_64 4.03-3.el6 epel 113 k
Transaction Summary
======================================================================================================================================
Install 1 Package(s)
Total download size: 113 k
Installed size: 151 k
Is this ok [y/N]: y
Downloading Packages:
libev-4.03-3.el6.x86_64.rpm | 113 kB 00:00
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
Userid : EPEL (6) <epel@fedoraproject.org>
Package: epel-release-6-8.noarch (@/epel-release-6-8.noarch)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libev-4.03-3.el6.x86_64 1/1
Verifying : libev-4.03-3.el6.x86_64 1/1
Installed:
libev.x86_64 0:4.03-3.el6
Complete!
再次安装成功
[root@gg /]# rpm -ivh percona-xtrabackup-24-2.4.11-1.el6.x86_64.rpm
warning: percona-xtrabackup-24-2.4.11-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing... ########################################### [100%]
1:percona-xtrabackup-24 ########################################### [100%]
使用
1、全备:
[root@gg ~]# innobackupex --user=root --password=mysql --socket=/tmp/mysql.sock /databackup/
2、增量备份
innobackupex --user=root --password=mysql --socket=/tmp/mysql.sock --increamental --increamental-dir /databackup/2018-06-14_11-33-40/