How to initialize a new cluster from a S3 backup?

Hi,

How do I create a new cluster and restore it from a S3 backup? I can only find how to restore a cluster from a previously saved backup (https://www.percona.com/doc/kubernetes-operator-for-pxc/backups.html#restore-the-cluster-from-a-previously-saved-backup).

I can not find how to restore a new cluster from a S3 backup on a new k8s cluster. How can I restore if somehow a “perconaxtradbclusterbackups.pxc.percona.com” resource object is lost?

I want to create a new pxc cluster and point it to a S3 backup to restore from. Is that possible?

Best regards,

Rickard

After some more research I found a “restore-backup.sh” script in the repository. (https://github.com/percona/percona-xtradb-cluster-operator/blob/master/deploy/backup/restore-backup.sh) . However, this script seem to be outdated. The restore fails when trying to restore a pxc cluster using a s3 url. The script is using a old version of the backup image: percona/percona-xtradb-cluster-operator:0.3.0-backup. The current is percona/percona-xtradb-cluster-operator:1.5.0-pxc8.0-backup.

The script fails on this line: https://github.com/percona/percona-xtradb-cluster-operator/blob/master/deploy/backup/restore-backup.sh#L245

mc -C /tmp/mc cat dest/$backup_bucket/$backup_key. “$backup_bucket/$backup_key” does not exist in the backups that current version of the operator creates.

Are there any plans to update this script to be compatible with the current version of the operator?

Hi Rickard,
Yes, you can restore data on newly created cluster.
All you need is a kubenetes pxc-backup object existing inside target namespace with backup path specified in status field like in https://raw.githubusercontent.com/percona/percona-xtradb-cluster-operator/master/e2e-tests/big-data/conf/backup.yml.

Than you need to create a pxc-restore object with reference to backup object like in https://raw.githubusercontent.com/percona/percona-xtradb-cluster-operator/master/e2e-tests/big-data/conf/restore-backup.yml
If everything is correct, pxc cluster will be restored from backup object.

Thank you @IvanPylypenko! This is what I was looking for.   
Maybe this should be included in the manual?  

@rckrd
Could you please create a ticket for that on https://jira.percona.com ?

I was unable to restore a backup from S3, a new backup job was created instead overwriting the values for the s3 url. I have created an issue here: https://jira.percona.com/browse/K8SPXC-437