Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

canonical/xtrabackup-snap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xtrabackup snap package

Snap package for xtrabackup open source backup tool by Percona.

Build

foo@bar:~$ snapcraft
# or
foo@bar:~$ snapcraft --use-lxd

Install

foo@bar:~$ sudo snap install ./xtrabackup_8.0.30-23_amd64.snap --dangerous

Usage

It's necessary to manually connect the mysql-files interface to allow access to read (on backup) and write (on restore) to database data directory.

foo@bar:~$ sudo snap connect xtrabackup:mysql-data

An example script for backing up to S3 is:

USER="<user>"
PASSWORD="<password>"
S3_BUCKET="backups"
S3_PATH="$(date -Iminutes)-backup"
S3_KEY="<s3-key>"
S3_SECRET="<s3-secret>"
HOST="a.database.domain"

xtrabackup --defaults-group=mysql --no-version-check \
    --parallel=$(grep -c processor /proc/cpuinfo) \
    --user=${USER} \
    --password=${PASSWORD} \
    --host=${HOST} \
    --lock-ddl \
    --no-server-version-check \
    --backup \
    --stream=xbstream \
    --xtrabackup-plugin-dir=/usr/lib/mysql/plugin \
    --target-dir=/tmp | \
    xtrabackup.xbcloud put \
    --curl-retriable-errors=7 --insecure --storage=s3 --parallel=10 --md5 \
    --s3-bucket="$S3_BUCKET" \
    --s3-access-key=$S3_KEY \
    --s3-secret-key=$S3_SECRET \
    "$S3_PATH"

Refer to official docs from Percona