mysql-operator icon indicating copy to clipboard operation
mysql-operator copied to clipboard

Download and restore a backup locally for testing/debugging

Open vitobotta opened this issue 5 years ago • 4 comments

Say I have some production data in a cluster managed by this operator, and that I have backups configured and working. How could I restore a backup locally on my Mac for testing or debugging issues with production data? Is there a quick and easy way to start some container and restore the data in one go or something like that? I can see that the archives include Xtrabackup files, if I am not mistaken. Thanks in advance!

vitobotta avatar May 08 '19 19:05 vitobotta

First, you have to download the *.xbackup.gz file, you can do that by using rclone for example. Then unzip it and stream it to xbstream.

The command will look something like this:

gunzip -c *.xbackup.gz | xbstream -x -C <path to MySQL data dir>

if using rclone will look somthing like:

rclone cat *.xbackup.gz | gzip -d | xbstream -x -C <path to MySQL data dir>

Once that command is completed then you have to prepare the backup by running xtrabackup like in this article:

xtrabackup --prepare --target-dir=<path to MySQL data dir>

Hope this helps! Please let me know if works or not. Best regards,

AMecea avatar May 08 '19 20:05 AMecea

Thanks! :)

vitobotta avatar May 08 '19 21:05 vitobotta

I think that this can be a section in the documentation. Thanks for pointing it out. I will reopen it.

AMecea avatar May 08 '19 21:05 AMecea

Just copying the instructions above into the backup.md docs would be a great help. :-)

abh avatar Jan 19 '20 08:01 abh