Restore new pxc cluster from s3 backup with


I’ve tried to restore s3 backup to new pxc cluster with percona-xtradb-cluster-operator/deploy/backup/ but I have this error :

+ mc -C /tmp/mc cat dest/mysql-operator/cluster1-2022-04-04-08:58:00-full
+ xbstream --decompress -x -C /datadir
mc: <ERROR> Unable to read from `dest/mysql-operator/cluster1-2022-04-04-08:58:00-full`. Object does not exist.

After some research I’ve modified and now it restore backup from s3 to new pxc cluster but I’ve new error when start_pxc() it’s called :

Error from server (Conflict): error when applying patch:
Resource: ", Resource=perconaxtradbclusters", GroupVersionKind: ", Kind=PerconaXtraDBCluster"
Name: "cluster1-restored", Namespace: "xtradb-from-scratch"
for: "/tmp/tmp.Q8F945epbH/cluster.yaml": Operation cannot be fulfilled on "cluster1-restored": the object has been modified; please apply your changes to the latest version and try again
1 Like

Hello @no_way ,

this script percona-xtradb-cluster-operator/deploy/backup/ was created long before our operator supported restore operation. It is heavily outdated.

We recommend to use the restore custom resource for restoration. See more details here: Providing Backups

In short you just need to create a restore manifest. An example of it you can find in percona-xtradb-cluster-operator/deploy/backup/restore.yaml

kind: PerconaXtraDBClusterRestore
  name: restore1
  pxcCluster: cluster1
  backupName: backup1
#  pitr:
#    type: latest
#    date: "yyyy-mm-dd hh:mm:ss"
#    gtid: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:nnn"
#    backupSource:
#      storageName: "STORAGE-NAME-HERE"
#      s3:
#        credentialsSecret: my-cluster-name-backup-s3
#        endpointUrl:
#        region: us-west-2
1 Like

Hello @spronin ,

Yes for PerconaXtraDBClusterRestore but my data are in s3 storage, how I can restore new cluster from s3 ?

thanks :slight_smile:

1 Like

If this backup was created by our Operator - you can still use PerconaXtraDBClusterRestore object.

You can read more about it here: Providing Backups
You will need to specify backupSource:

  destination: s3://S3-BUCKET-NAME/BACKUP-NAME
    credentialsSecret: my-cluster-name-backup-s3
    region: us-west-2
    endpointUrl: https://URL-OF-THE-S3-COMPATIBLE-STORAGE

If this backup was created by some other tooling - PerconaXtraDBClusterRestore might work if you follow the process described in this blog post: Migrating Into Kubernetes Running the Percona Distribution for MySQL Operator - Percona Database Performance Blog

Otherwise, use regular restoration process by connecting to MySQL endpoint (expose the database with Operator and perform a regular restore).

1 Like