良许Linux教程网 干货合集 使用xtrabackup对mysql 5.7进行备份

使用xtrabackup对mysql 5.7进行备份

xtrabackup是Percona公司CTO Vadim参与开发的一款基于InnoDB的在线热备工具,具有开源,免费,支持在线热备,备份恢复速度快,占用磁盘空间小等特点,并且支持不同情况下的多种备份形式。

image-20220128122325197

安装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

这里我们写一个shell脚本做备份

#!/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

以上就是良许教程网为各位朋友分享的Linu系统相关内容。想要了解更多Linux相关知识记得关注公众号“良许Linux”,或扫描下方二维码进行关注,更多干货等着你 !

img
本文由 良许Linux教程网 发布,可自由转载、引用,但需署名作者且注明文章出处。如转载至微信公众号,请在文末添加作者公众号二维码。
良许

作者: 良许

良许,世界500强企业Linux开发工程师,公众号【良许Linux】的作者,全网拥有超30W粉丝。个人标签:创业者,CSDN学院讲师,副业达人,流量玩家,摄影爱好者。
上一篇
下一篇

发表评论

联系我们

联系我们

公众号:良许Linux

在线咨询: QQ交谈

邮箱: yychuyu@163.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部