Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mariabackup incremental backup restore

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Full and incremental process commands

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. Recovery process

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. Special instructions

MariaDB10.2.7 no longer supports online physical hot backup using Percona XtraBackup tools, so I just copy a similar tool.

4. Prepare the backup version difference

MariaDB starting with 10.2 uses mariabackup-- prepare\-- target-dir=/var/mariadb/backupMariaDB until 10.1Use $mariabackup-- prepare-- apply-log-only\-- target-dir=/var/mariadb/backup

5. Full amount once a week, the rest of the incremental scripts

#! / bin/bashLOCALDIR=/data/mysqlbakWEEKDAY= `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/fullINCR=/$LOCALDIR/$TISHWEEKFULL/incr/$TODAYYESTERDAYDIR=/$LOCALDIR/$TISHWEEKFULL/incr/$YESTERDAYif [!-d $FULL] Thenecho "No lsn information, start a complete" mkdir-p $FULL/ usr/bin/mariabackup-- backup-- slave-info-- kill-long-queries-timeout=120-- kill-long-query-type=select-- target-dir=$FULL/exit 0fimkdir-p $INCRif [!-d $YESTERDAYDIR] Then / usr/bin/mariabackup-backup-- slave-info-- kill-long-queries-timeout=120-- kill-long-query-type=select-- target-dir=$INCR/-- incremental-basedir=$FULLexit 0fi / usr/bin/mariabackup-- backup-- slave-info-- kill-long-queries-timeout=120-- kill-long-query-type=select-- target-dir=$INCR/-- incremental-basedir=$YESTERDAYDIR

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report