bitpoke / mysql-operator

Asynchronous MySQL Replication on Kubernetes using Percona Server and Openark's Orchestrator.
https://www.bitpoke.io/docs/mysql-operator/getting-started/
Apache License 2.0
1.03k stars 276 forks source link

Download and restore a backup locally for testing/debugging #316

Open vitobotta opened 5 years ago

vitobotta commented 5 years ago

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!

AMecea commented 5 years ago

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,

vitobotta commented 5 years ago

Thanks! :)

AMecea commented 5 years ago

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

abh commented 4 years ago

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