How to restore percona database from kubernetes?

All we need is an easy explanation of the problem, so here it is.

I got the backup works by setting these on the helm chart values (it works according to the documentation):

    google-cloud-storage-s3:
      type: s3
      s3:
        bucket: gcp_bucket
        credentialsSecret: google-cloud-storage-s3-backup
        region: us-west2
        endpointUrl: https://storage.googleapis.com/

It’s uploaded successfully on the google cloud storage:
How to restore percona database from kubernetes?

Then I tried to restore the backup:

gsutil -m cp -r \                                      
  "gs://gcp_bucket/percona-2021-05-06-00:00:11-full.md5" \
  "gs://gcp_backup/percona-2021-05-06-00:00:11-full.sst_info/" \
  "gs://gcp_backup/percona-2021-05-06-00:00:11-full/" \
  .
| [1.1k/1.1k files][  2.7 GiB/  2.7 GiB] 100% Done 942.3 KiB/s ETA 00:00:00     
Operation completed over 1.1k objects/2.7 GiB. 

sudo apt install percona-server-server percona-xtrabackup-80

The documentation said:

service mysqld stop
rm -rf /var/lib/mysql/*
cat xtrabackup.stream | xbstream -x -C /var/lib/mysql # --> where is this from?
xtrabackup --prepare --target-dir=/var/lib/mysql 
chown -R mysql:mysql /var/lib/mysql
service mysqld start

The problem is, I could not find any file named copy-backup.sh or xtrabackup.stream in the backup directories, is there other way to restore the backup, also all files compressed with lz4?
How to restore percona database from kubernetes?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

The copy-backup.sh can be found on the repo

Then following the commands on the documentation will produce xtrabackup.stream file.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply