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

Latest commit

 

History

History
60 lines (46 loc) · 1.38 KB

README.md

File metadata and controls

60 lines (46 loc) · 1.38 KB

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