-
Notifications
You must be signed in to change notification settings - Fork 0
110_Making Percona Backups
This page provides instructions for creating backups for Percona and restoring them, whether it's on the same server or a replica server. Each step includes an identity that indicates which application should be used for the instructions that proceed. Examples are also provided for steps that have varying parameters depending on the context (server names, usernames, passwords, etc).
Note: Even though each new step indicates shelling into the server, it is not necessary often as you can continue on a previously open terminal that is already shelled into the server. The goal is to provide ease of understanding if a specific portion needs to be configured or changed in contrast from going through start to finish.
The following values will be used for the examples:
Parameter | Value |
---|---|
User on VPS servers | luke |
Primary Percona Server | b13.jmaconsulting.biz |
Secondary Percona Server | ovh13.jmaconsulting.biz |
- Percona primary secondary replication servers configured
1. Create The Encrypted Backup on the Primary Percona Server [source]
Identity: Local Machine, Terminal
# shell into Active Percona Server
$ ssh [user]@[host]
# ===== example =====
$ ssh [email protected]
Identity: Primary Percona Server, Terminal
# changes to prevent error from occuring when creating the backup
$ ulimit -n 60000
# create and prepare the backup
$ xtrabackup --backup --target-dir=/data/backups/mysql --user=root -p
$ xtrabackup --prepare --target-dir=/data/backups/mysql
--keyring-vault-config=/var/lib/mysql-keying/keyring_vault.conf
# zip the backup directory
$ zip -r /data/backups/mysql
$ mv mysql.zip /home/[user]
$ chown [user]:[user] /home/[user]/mysql.zip
# ===== example =====
$ zip -r /data/backups/mysql
$ mv mysql.zip /home/luke
$ chown luke:luke /home/luke/mysql.zip
Identity: Local Machine, Terminal
$ scp [email protected]:/home/luke/mysql.zip /local/directory/location
$ scp /local/directory/location/mysql.zip [email protected]:/home/luke/mysql.zip
3. Load the Backup to the Secondary Server [source]
Identity: Local Machine, Terminal
# shell into Active Percona Server
$ ssh [user]@[host]
# ===== example =====
$ ssh [email protected]
Identity: Primary Percona Server, Terminal
# create and prepare the backup. Note: since the data directory on the secondary server might not be empty, it is recommended to make a copy of the /var/lib/mysql directory elsewhere and create an new empty directory
$ xtrabackup --copy-back --target-dir=/data/backups/mysql --datadir=/var/lib/mysql