Skip to content

Commit

Permalink
concurrent backup stream compression
Browse files Browse the repository at this point in the history
  • Loading branch information
crishoj authored and quique committed Jul 16, 2021
1 parent 6cf7e07 commit 66227ad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions run-mariabackup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ MYSQL_USER=backup
MYSQL_HOST=localhost
MYSQL_PORT=3306
BACKCMD=mariabackup # Galera Cluster uses mariabackup instead of xtrabackup.
GZIPCMD=pigz -p8
BACKDIR=/data/mysql_backup
FULLBACKUPCYCLE=604800 # Create a new full backup every X seconds
KEEP=3 # Number of additional backups cycles a backup should kept for.
Expand Down Expand Up @@ -130,15 +131,15 @@ then
mkdir -p $TARGETDIR

# Create incremental Backup
$BACKCMD --backup $USEROPTIONS $ARGS --extra-lsndir=$TARGETDIR --incremental-basedir=$INCRBASEDIR --stream=xbstream | gzip > $TARGETDIR/backup.stream.gz
$BACKCMD --backup $USEROPTIONS $ARGS --extra-lsndir=$TARGETDIR --incremental-basedir=$INCRBASEDIR --stream=xbstream | $GZIPCMD > $TARGETDIR/backup.stream.gz
else
echo 'New full backup'

TARGETDIR=$BASEBACKDIR/`date +%F_%H-%M-%S`
mkdir -p $TARGETDIR

# Create a new full backup
$BACKCMD --backup $USEROPTIONS $ARGS --extra-lsndir=$TARGETDIR --stream=xbstream | gzip > $TARGETDIR/backup.stream.gz
$BACKCMD --backup $USEROPTIONS $ARGS --extra-lsndir=$TARGETDIR --stream=xbstream | $GZIPCMD > $TARGETDIR/backup.stream.gz
fi

MINS=$(($FULLBACKUPCYCLE * ($KEEP + 1 ) / 60))
Expand Down

0 comments on commit 66227ad

Please sign in to comment.