diff options
| author | Zuul <zuul@review.openstack.org> | 2018-11-06 20:09:43 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2018-11-06 20:09:43 +0000 |
| commit | 9b0f15bf4c74f9990f679c84e9abe3b45317e7c6 (patch) | |
| tree | 05f724a70218c0325d7c98c84891a769703eee3b /docker/xtrabackup/backup.sh | |
| parent | 401f7fd234de9bec49c3ea602a14062cd0c81099 (diff) | |
| parent | 25de6deb4b229413c89eb9592d116fa621b15ade (diff) | |
| download | kolla-9b0f15bf4c74f9990f679c84e9abe3b45317e7c6.tar.gz kolla-9b0f15bf4c74f9990f679c84e9abe3b45317e7c6.zip | |
Merge "Introduce Percona XtraBackup image"
Diffstat (limited to 'docker/xtrabackup/backup.sh')
| -rwxr-xr-x | docker/xtrabackup/backup.sh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/docker/xtrabackup/backup.sh b/docker/xtrabackup/backup.sh new file mode 100755 index 000000000..f8dff8bd7 --- /dev/null +++ b/docker/xtrabackup/backup.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +set -eu + +# Execute a full backup +backup_full() { + echo "Taking a full backup" + innobackupex --defaults-file=/etc/mysql/my.cnf \ + --no-timestamp \ + --stream=xbstream \ + --compress \ + --history=$(date +%d-%m-%Y) ./ > \ + $BACKUP_DIR/mysqlbackup-$(date +%d-%m-%Y-%s).qp.xbc.xbs +} + +# Execute an incremental backup +backup_incremental() { + echo "Taking an incremental backup" + innobackupex --defaults-file=/etc/mysql/my.cnf \ + --no-timestamp \ + --stream=xbstream \ + --compress \ + --incremental \ + --incremental-history-name=$(date +%d-%m-%Y) \ + --history=$(date +%d-%m-%Y) ./ > \ + $BACKUP_DIR/incremental-$(date +%H)-mysqlbackup-$(date +%d-%m-%Y-%s).qp.xbc.xbs +} + +BACKUP_DIR=/backup/ +cd $BACKUP_DIR + +if [ -n $BACKUP_TYPE ]; then + case $BACKUP_TYPE in + "full") + backup_full + ;; + "incremental") + backup_incremental + ;; + *) + echo "Only full or incremental options are supported." + exit 1 + ;; + esac +else + echo "You need to specify either full or incremental backup options." + exit 1 +fi + |
