centos7.2上安装MySQL的备份工具xtrabackup,建议挂载镜像,配置YUM源,使用yum进行安装来解决包依赖关系;
除非使用编译安装,不要再使用rpm -ivh来安装xtrabackup了,包依赖关系解决起来累死人,尤其是操作系统是最小化安装
的那种。
1、配置yum源
--获取rpm包
rpm -ivh http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm
--yum仓库
[percona]name = CentOS $releasever - Perconabaseurl=http://repo.percona.com/centos/$releasever/os/$basearch/
enabled = 1
gpgkey = file:///mnt/pki/rpm-gpg/RPM-GPG-KEY-percona
gpgcheck = 1
--获取key-percona
wget http://www.percona.com/redir/downloads/percona-release/RPM-GPG-KEY-percona
cp RPM-GPG-KEY-percona /mnt/pki/rpm-gpg/RPM-GPG-KEY-percona
2、配置好yum源之后,首先安装xtrabackup运行环境必须的perl
[root@idc-srm-MysqL-db xtrabackup]# yum -y install perl
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package perl.x86_64 4:5.16.3-286.el7 will be updated
---> Package perl.x86_64 4:5.16.3-292.el7 will be an update
--> Processing Dependency: perl-libs = 4:5.16.3-292.el7 for package: 4:perl-5.16.3-292.el7.x86_64
--> Running transaction check
---> Package perl-libs.x86_64 4:5.16.3-286.el7 will be updated
---> Package perl-libs.x86_64 4:5.16.3-292.el7 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================================================
Updating:
perl x86_64 4:5.16.3-292.el7 base 8.0 M
Updating for dependencies:
perl-libs x86_64 4:5.16.3-292.el7 base 688 k
Transaction Summary
=======================================================================================================================================================================
Upgrade 1 Package (+1 Dependent package)
Total download size: 8.6 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/2): perl-libs-5.16.3-292.el7.x86_64.rpm | 688 kB 00:00:00
(2/2): perl-5.16.3-292.el7.x86_64.rpm | 8.0 MB 00:00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 44 MB/s | 8.6 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Updating : 4:perl-libs-5.16.3-292.el7.x86_64 1/4
Updating : 4:perl-5.16.3-292.el7.x86_64 2/4
Cleanup : 4:perl-libs-5.16.3-286.el7.x86_64 3/4
Cleanup : 4:perl-5.16.3-286.el7.x86_64 4/4
Verifying : 4:perl-5.16.3-292.el7.x86_64 1/4
Verifying : 4:perl-libs-5.16.3-292.el7.x86_64 2/4
Verifying : 4:perl-libs-5.16.3-286.el7.x86_64 3/4
Verifying : 4:perl-5.16.3-286.el7.x86_64 4/4
Updated:
perl.x86_64 4:5.16.3-292.el7
Dependency Updated:
perl-libs.x86_64 4:5.16.3-292.el7
Complete!
[root@idc-srm-MysqL-db xtrabackup]#
3、然后安装perl-DBD
[root@idc-srm-MysqL-db xtrabackup]# yum -y install perl-DBD
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
No package perl-DBD available.
Error: nothing to do
[root@idc-srm-MysqL-db xtrabackup]# yum -y install perl-dbd-mysql
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package perl-dbd-mysql.x86_64 0:4.023-5.el7 will be installed
--> Processing Dependency: perl(DBI::Const::GetInfoType) for package: perl-dbd-mysql-4.023-5.el7.x86_64
--> Processing Dependency: perl(DBI) for package: perl-dbd-mysql-4.023-5.el7.x86_64
--> Running transaction check
---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
--> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
--> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
--> Running transaction check
---> 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(Net::Daemon::Test) 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(Compress::Zlib) 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::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
--> Processing Dependency: perl(Compress::Raw::Bzip2) >= 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:
perl-dbd-mysql x86_64 4.023-5.el7 base 140 k
Installing for dependencies:
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 base 57 k
perl-DBI x86_64 1.627-4.el7 base 802 k
perl-IO-Compress noarch 2.061-2.el7 base 260 k
perl-Net-Daemon noarch 0.48-5.el7 base 51 k
perl-PlRPC noarch 0.2020-14.el7 base 36 k
Transaction Summary
=======================================================================================================================================================================
Install 1 Package (+6 Dependent packages)
Total download size: 1.3 M
Installed size: 3.4 M
Downloading packages:
(1/7): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:00:00
(2/7): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm | 57 kB 00:00:00
(3/7): perl-dbd-mysql-4.023-5.el7.x86_64.rpm | 140 kB 00:00:00
(4/7): perl-DBI-1.627-4.el7.x86_64.rpm | 802 kB 00:00:00
(5/7): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB 00:00:00
(6/7): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 51 kB 00:00:00
(7/7): perl-PlRPC-0.2020-14.el7.noarch.rpm | 36 kB 00:00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 8.1 MB/s | 1.3 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 1/7
Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 2/7
Installing : perl-IO-Compress-2.061-2.el7.noarch 3/7
Installing : perl-Net-Daemon-0.48-5.el7.noarch 4/7
Installing : perl-PlRPC-0.2020-14.el7.noarch 5/7
Installing : perl-DBI-1.627-4.el7.x86_64 6/7
Installing : perl-dbd-mysql-4.023-5.el7.x86_64 7/7
Verifying : perl-Net-Daemon-0.48-5.el7.noarch 1/7
Verifying : perl-IO-Compress-2.061-2.el7.noarch 2/7
Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 3/7
Verifying : perl-PlRPC-0.2020-14.el7.noarch 4/7
Verifying : perl-dbd-mysql-4.023-5.el7.x86_64 5/7
Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 6/7
Verifying : perl-DBI-1.627-4.el7.x86_64 7/7
Installed:
perl-dbd-mysql.x86_64 0:4.023-5.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-DBI.x86_64 0:1.627-4.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@idc-srm-MysqL-db xtrabackup]#
4、然后安装perl-Digest-MD5
[root@idc-srm-MysqL-db xtrabackup]# yum -y install perl-Digest-MD5
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> 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-Digest.noarch 0:1.17-245.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================================================
Installing:
perl-Digest-MD5 x86_64 2.52-3.el7 base 30 k
Installing for dependencies:
perl-Digest noarch 1.17-245.el7 base 23 k
Transaction Summary
=======================================================================================================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 53 k
Installed size: 82 k
Downloading packages:
(1/2): perl-Digest-1.17-245.el7.noarch.rpm | 23 kB 00:00:00
(2/2): perl-Digest-MD5-2.52-3.el7.x86_64.rpm | 30 kB 00:00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 569 kB/s | 53 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : perl-Digest-1.17-245.el7.noarch 1/2
Installing : perl-Digest-MD5-2.52-3.el7.x86_64 2/2
Verifying : perl-Digest-1.17-245.el7.noarch 1/2
Verifying : perl-Digest-MD5-2.52-3.el7.x86_64 2/2
Installed:
perl-Digest-MD5.x86_64 0:2.52-3.el7
Dependency Installed:
perl-Digest.noarch 0:1.17-245.el7
Complete!
[root@idc-srm-MysqL-db xtrabackup]
5、最后安装percona-xtrabackup
[root@idc-srm-MysqL-db xtrabackup]# yum -y install percona-xtrabackup
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package percona-xtrabackup.x86_64 0:2.3.6-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================================================
Installing:
percona-xtrabackup x86_64 2.3.6-1.el7 base 4.6 M
Transaction Summary
=======================================================================================================================================================================
Install 1 Package
Total download size: 4.6 M
Installed size: 18 M
Downloading packages:
percona-xtrabackup-2.3.6-1.el7.x86_64.rpm | 4.6 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : percona-xtrabackup-2.3.6-1.el7.x86_64 1/1
Verifying : percona-xtrabackup-2.3.6-1.el7.x86_64 1/1
Installed:
percona-xtrabackup.x86_64 0:2.3.6-1.el7
Complete!
[root@idc-srm-MysqL-db xtrabackup]#
6、查看 xtrabackup版本
[root@idc-srm-MysqL-db xtrabackup]# xtrabackup --version
xtrabackup version 2.3.6 based on MysqL server 5.6.24 Linux (x86_64) (revision id: )
[root@idc-srm-MysqL-db xtrabackup]#
到此 xtrabackup安装完成,可以使用了,如果是rpm安装会非常麻烦,一个个rpm包依赖,找起来困难,安装起来麻烦,还浪费时间。