由于之前服务器安装的xtrabackup比较老的版本,不支持mysql 5.7的热备,需要升级下版本或新服务器部署2.4.1版本。这里我们下载官网https://www.percona.com/downloads/XtraBackup/ 最新版2.4.4 工具,安装并备份mysql 5.7。 |
安装XtraBackup
这里不多做解释了,之前文章有介绍如何安装。 这里主要说下常见报错,比如我这里今天遇到两个:
error: Failed dependencies: libev.so.4()(64bit) is needed by percona-xtrabackup-24-2.4.4-1.el6.x86_64 libnuma.so.1()(64bit) is needed by percona-xtrabackup-24-2.4.4-1.el6.x86_64
(1) libev.so.4()(64bit) is needed by percona-xtrabackup-24-2.4.4-1..el6.x86_64解决办法:
rpm -ivh ftp://rpmfind.net/linux/dag/redhat/el6/en/x86_64/dag/RPMS/libev-4.15-1.el6.rf.x86_64.rpm
安装上边rpm包解决
(2)libnuma.so.1()(64bit) is needed by percona-xtrabackup-24-2.4.4-1.el6.x86_64解决办法:
rpm -ivh http://mirror.centos.org/centos/6/os/x86_64/Packages/numactl-2.0.9-2.el6.x86_64.rpm
安装上边rpm包解决。
备份mysql
#!/bin/bash # mysql full back #date 2016.10.18 #author:21yunwei time=`date +%F` logfile="/data/bakup/mysql_full_bak_time.log" fullbakup_logfile="/data/bakup/fullbakup_logfile.log" mysql_bakdir="/data/bakup" user=xxxxx password=xxxxxxx [ ! -d $mysql_bakdir ] && mkdir -p $mysql_bakdir [ ! -e $logfile ] && touch $logfile [ ! -e $fullbakup_logfile ] && touch $fullbakup_logfile innobackupex --defaults-file=/etc/my.cnf --user=$user --password=$passsword--compress ${mysql_bakdir} 2>&1 >>$fullbakup_logfile ret=$? finishtime=`date +%Y%m%d_%H%M%S` [ $ret -eq 0 ] && echo "Mysql fullbakup finished, time: $finishtime" >> $logfile || echo "Mysql fullbakup failed,please check time:$finishtime" >> $logfile
来源:oschina
链接:https://my.oschina.net/u/3585265/blog/3139247