1、全备和增量过程命令
mariabackup --backup --target-dir=/var/mariadb/backup/ --user=root --password= mariabackup --backup --target-dir=/var/mariadb/inc1/ --incremental-basedir=/var/mariadb/backup/ --user=root --password= mariabackup --backup --history --target-dir=/var/mariadb/inc2/ --incremental-basedir=/var/mariadb/inc1 --user=root --password= mariabackup --backup --history --target-dir=/var/mariadb/inc3/ --incremental-basedir=/var/mariadb/inc2 --user=root --password=
2、恢复过程
mariabackup --prepare --target-dir=/var/mariadb/backup mariabackup --prepare --target-dir=/var/mariadb/backup --incremental-dir=/var/mariadb/inc1 mariabackup --prepare --target-dir=/var/mariadb/backup --incremental-dir=/var/mariadb/inc2 mariabackup --prepare --target-dir=/var/mariadb/backup --incremental-dir=/var/mariadb/inc3 /etc/init.d/mysql stop mariabackup --copy-back --target-dir=/var/mariadb/backup/ /etc/init.d/mysql start
3、特别说明
MariaDB10.2.7以后不再支持使用Percona XtraBackup工具在线物理热备份,所以就自己copy一个类似工具
4、准备备份版本差异
MariaDB starting with 10.2 使用 mariabackup --prepare \ --target-dir=/var/mariadb/backup MariaDB until 10.1 使用 $ mariabackup --prepare --apply-log-only \ --target-dir=/var/mariadb/backup
5、每周一次全量,其余增量脚本
#!/bin/bash LOCALDIR=/data/mysqlbak WEEKDAY=`date +%u` INTERVARNUM=`expr $WEEKDAY - 1` TISHWEEKFULL=`date -d "$INTERVARNUM day ago" +%F` YESTERDAY=`date -d "1 day ago" +%F` TODAY=`date +%F` FULL=/$LOCALDIR/$TISHWEEKFULL/full INCR=/$LOCALDIR/$TISHWEEKFULL/incr/$TODAY YESTERDAYDIR=/$LOCALDIR/$TISHWEEKFULL/incr/$YESTERDAY if [ ! -d $FULL ] ;then echo "没有lsn信息,开始一次全备" mkdir -p $FULL /usr/bin/mariabackup --backup --slave-info --kill-long-queries-timeout=120 --kill-long-query-type=select --target-dir=$FULL/ exit 0 fi mkdir -p $INCR if [ ! -d $YESTERDAYDIR ] ;then /usr/bin/mariabackup --backup --slave-info --kill-long-queries-timeout=120 --kill-long-query-type=select --target-dir=$INCR/ --incremental-basedir=$FULL exit 0 fi /usr/bin/mariabackup --backup --slave-info --kill-long-queries-timeout=120 --kill-long-query-type=select --target-dir=$INCR/ --incremental-basedir=$YESTERDAYDIR
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。