percona-xtrabackup-2.4.28源码编译安装和二进制安装
################
percona-xtrabackup官网下载地址:
https://www.percona.com/software/mysql-database/percona-xtrabackup
percona-xtrabackup在github上的源码:
https://github.com/percona/percona-xtrabackup.git
根据需要选择二进制安装包、rpm安装包、源代码包:
一、二进制安装
1、有的版本可能与系统的libgcrypt版本有关,需要核对版本后下载对应版本的二进制安装包
./innobackupex --version innobackupex: error while loading shared libraries: libgcrypt.so.20: cannot open shared object file: No such file or directory # 查看服务器上的libgcrypt版本,发现是xtrabackup版本下载错误,下载对应的libgcrypt的版本的包就可以了 [work@a8-cloud-dba-db08 data]$ yum list installed|grep libgcrypt libgcrypt.x86_64 1.5.3-14.el7 @anaconda libgcrypt-devel.x86_64 1.5.3-14.el7 @base
2、有的版本与glibc版本相关
[root@a8-cloud-dba-db08 install_database]# sh info_system.sh centos version: 7.9.2009 arch type: x86-64 cpu cores: 4 mem sizeGB: 11G swap sizeGB: 5.8G glibc version: 2.17 libgcrypt version: libgcrypt-1.5.3-14.el7.x86_64 gcc version: 8.3.1 git version: 2.39.1 cmake version: 3.5.2 make version: 4.2.1 bison version: 3.0.4 openssl version: 1.0.2k-fips git version: git version: Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 5.8G 0 5.8G 0% /dev tmpfs tmpfs 5.8G 0 5.8G 0% /dev/shm tmpfs tmpfs 5.8G 9.4M 5.8G 1% /run tmpfs tmpfs 5.8G 0 5.8G 0% /sys/fs/cgroup /dev/mapper/centos-root xfs 50G 9.6G 41G 20% / /dev/sda1 xfs 1014M 246M 769M 25% /boot /dev/sdb1 xfs 466G 95G 372G 21% /data /dev/mapper/centos-home xfs 55G 28G 28G 50% /home tmpfs tmpfs 1.2G 0 1.2G 0% /run/user/0
64位系统报错信息如下# ./xtrabackup
./xtrabackup: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./xtrabackup)
# whereis libstdc++.so.6
libstdc++.so: /usr/lib64/libstdc++.so.5 /usr/lib64/libstdc++.so.6
原因是没有GLIBCXX_3.4.15版本,或是更高的版本。
输入命令查询一下结果:
# strings /usr/lib64/libstdc++.so.6 | grep GLIBCX
下载64位系统:
解压:
ar -x libstdc++6_4.7.2-5_i386.deb && tar xvf data.tar.gz
# cp libstdc++.so.6.0.17 /usr/lib64
rm libstdc++.so.6
重新建立软连接
ln libstdc++.so.6.0.17 libstdc++.so.6
strings /usr/lib/libstdc++.so.6 | grep GLIBCXX
wget https://downloads.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-2.4.24/binary/redhat/6/x86_64/percona-xtrabackup-80-8.0.14-1.el6.x86_64.rpm wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.4.7/binary/redhat/6/x86_64/percona-xtrabackup-24-2.4.7-2.el6.x86_64.rpm wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.4.7/binary/redhat/6/x86_64/percona-xtrabackup-24-debuginfo-2.4.7-2.el6.x86_64.rpm rpm -ivh percona-xtrabackup-24-2.4.7-2.el6.x86_64.rpm xtrabackup -version
二、源码编译安装
================================ How to build XtraBackup on Linux ================================ Prerequisites ------------- The following packages and tools must be installed to compile Percona XtraBackup from source. These might vary from system to system. In Debian-based distributions, you need to: $ apt-get install build-essential flex bison cmake libaio-dev \ mysql-client libncurses-dev zlib1g-dev libgcrypt11-dev \ libcurl4-gnutls-dev libev-dev python-sphinx vim-common In RPM-based distribution (like CentOS 7), you need to: $ yum install cmake gcc gcc-c++ libaio libaio-devel bison ncurses-devel \ libgcrypt-devel libcurl-devel libev-devel python-sphinx vim-common For CentOS 5 use ncurses5-devel instead ncurses-devel Compiling with CMake -------------------- At the base directory of the source code tree, if you execute $ cmake -DBUILD_CONFIG=xtrabackup_release && make -j4 and you go for a coffee, at your return XtraBackup will be ready to be used. Installation ------------ The following command: $ make install will install all XtraBackup binaries, the innobackupex script and tests to /usr/local/xtrabackup. You can override this either with “make DESTDIR=... install” or by changing the installation layout with “cmake -DINSTALL_LAYOUT=...”.
全量备份流程总结:
-
复制已有的redo log,然后监听redo log变化并持续复制
-
复制事务引擎数据文件
-
等到数据文件复制完成
-
加锁:全局读锁
-
备份非事务引擎数据文件及其他文件
-
获取binlog点位信息等元数据
-
停止复制redo log
-
解锁:全局读锁
-
复制buffer pool dump
-
备份完成
#################
igoodful@qq.com