Till the end of this topic, you will come to know Steps to Restore XtraBackup to AWS Aurora.
One of our customers is using Percona Xtrabackup to backup their on-prem/EC2 Mysql databases.
We were in a situation to restore their on-prem/Ec2 database to Aurora. The size of the database is around 1.6TB. Option in front of us was to take mysqldump and restore but this option is more time consuming but this possible from this below step.
So we decided to restore the existing Percona’s backup. AWS already documented this process here. In this documentation, they used innobackupex script to backup, but we can use xtrabackup instead.
What is Xtrabackup?
It is an open-source utility for MySQL. It is used for taking hot backup MySQL based servers which will not lock our database during the backup.
It can back up data from InnoDB, XtraDB, and MyISAM tables on MySQL 5.1 [1], 5.5, 5.6, and 5.7 servers, as well as Percona Server with XtraDB. Percona XtraBackup is designed in such a way that it make backups without disrupting the performance of the server in a production/development/stagging environment.
Command to take Backup from xtrabackup :
xtrabackup --backup --user=root --password=xxxx--target-dir=/tmp/xtrabackup
Upload the backup folder to S3
aws s3 sync /tmp/xtrabackup s3://****/xtrabackup
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetBucketLocation" ], "Resource": [ "arn:aws:s3:::<bucket name>" ] }, { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": [ "arn:aws:s3:::<bucket name>/<prefix>*" ] } ] }
-
- Advanced settings
- Database Options
- Failover
- Backup
- Monitoring
- Maintenance
Don’t compress the backup directory after the backup, it won’t work.
innobackupex --user=root --password=xxxx --stream=tar /tmp/innobackupex | gzip - | split -d --bytes=512000 - /tmp/innobackupex/backup.tar.gz Or xtrabackup --user=root --password=xxxx --stream=tar /tmp/innobackupex | gzip - | split -d --bytes=512000 - /tmp/ xtrabackup /backup.tar.gz
Thanks for sharing this blog with us, Please keep posting.
Your good knowledge and kindness in playing with all the pieces were
very useful.