xtrabackup远程流备份脚本
1、xbstream 流,本地文件夹可以自己创建,异地文件夹必须存在
十多年的延庆网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。全网整合营销推广的优势是能够根据用户设备显示端的尺寸不同,自动调整延庆建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联公司从事“延庆网站设计”,“延庆网站推广”以来,每个客户项目都认真落实执行。
innobackupex --host=127.0.0.1 --post=3306 --stream=xbstream --compress /root/backup/ | ssh root@192.168.56.15 "xbstream -x -C /tmp/"
2、xbstream 流,对端机器需要解压并清理压缩文件
192.168.56.15 xtrabackup --decompress --target-dir=/tmp/ find /tmp/ -name "*.qp" |xargs rm -f
3、xbstream 流对端需要安装软件
3.1 xtrabackup
3.2 qpress-11-linux-x64.tar
4、脚本,周一全备,其它都是增备
[root@es1 chkpoint]# cat backup.sh #!/bin/bash LOCALDIR=/data/backup CHECKPIONTDIR=$LOCALDIR/chkpoint REMOTEDIR=/tmp/ WEEKDAY=`date +%u` INTERVARNUM=`expr $WEEKDAY - 1` TISHWEEKFULL=`date -d "$INTERVARNUM day ago" +%F` TODAY=`date +%F` ssh root@192.168.56.19 "mkdir -p /$REMOTEDIR/$TISHWEEKFULL" ssh root@192.168.56.19 "mkdir -p /$REMOTEDIR/$TISHWEEKFULL/$TODAY" if [ ! -f $CHECKPIONTDIR/xtrabackup_checkpoints ] ;then echo "没有lsn信息,开始一次全备" innobackupex --host=127.0.0.1 --history --post=3306 --stream=xbstream --compress --extra-lsndir=$CHECKPIONTDIR $LOCALDIR |ssh root@192.168.56.19 "xbstream -x -C /$REMOTEDIR/$TISHWEEKFULL/" exit 1 fi case $WEEKDAY in #判断变量WEEKDAY的值 "1") innobackupex --host=127.0.0.1 --history --post=3306 --stream=xbstream --compress --extra-lsndir=$CHECKPIONTDIR $LOCALDIR |ssh root@192.168.56.19 "xbstream -x -C /$REMOTEDIR/$TISHWEEKFULL/" ;; "2") innobackupex --host=127.0.0.1 --post=3306 --stream=xbstream --history --incremental --extra-lsndir=$CHECKPIONTDIR --incremental-basedir=$CHECKPIONTDIR --compress $LOCALDIR | ssh root@192.168.56.19 "xbstream -x -C /$REMOTEDIR/$TISHWEEKFULL/$TODAY" ;; "3") innobackupex --host=127.0.0.1 --post=3306 --stream=xbstream --history --incremental --extra-lsndir=$CHECKPIONTDIR --incremental-basedir=$CHECKPIONTDIR --compress $LOCALDIR | ssh root@192.168.56.19 "xbstream -x -C /$REMOTEDIR/$TISHWEEKFULL/$TODAY" ;; "4") innobackupex --host=127.0.0.1 --post=3306 --stream=xbstream --history --incremental --extra-lsndir=$CHECKPIONTDIR --incremental-basedir=$CHECKPIONTDIR --compress $LOCALDIR | ssh root@192.168.56.19 "xbstream -x -C /$REMOTEDIR/$TISHWEEKFULL/$TODAY" ;; "5") innobackupex --host=127.0.0.1 --post=3306 --stream=xbstream --history --incremental --extra-lsndir=$CHECKPIONTDIR --incremental-basedir=$CHECKPIONTDIR --compress $LOCALDIR | ssh root@192.168.56.19 "xbstream -x -C /$REMOTEDIR/$TISHWEEKFULL/$TODAY" ;; "3") innobackupex --host=127.0.0.1 --post=3306 --stream=xbstream --history --incremental --extra-lsndir=$CHECKPIONTDIR --incremental-basedir=$CHECKPIONTDIR --compress $LOCALDIR | ssh root@192.168.56.19 "xbstream -x -C /$REMOTEDIR/$TISHWEEKFULL/$TODAY" ;; "4") innobackupex --host=127.0.0.1 --post=3306 --stream=xbstream --history --incremental --extra-lsndir=$CHECKPIONTDIR --incremental-basedir=$CHECKPIONTDIR --compress $LOCALDIR | ssh root@192.168.56.19 "xbstream -x -C /$REMOTEDIR/$TISHWEEKFULL/$TODAY" ;; esac
5、tar 目前不支持增备,压缩解压需要注意,需要tar -xizvf *.tar.gz
新闻标题:xtrabackup远程流备份脚本
路径分享:http://cdiso.cn/article/igcieg.html