Restore from deleted backup

Hi everyone, I have a simple straightforward question, but I have not found anything about this in the official documentation.

I deployed Percona MongoDB Operator and Percona MongoDB Server (sharded) on my Kubernetes cluster, with MinIO used as S3 storage.

The scenario is the following:

  • I have created a backup using the Backup yaml file.
  • The backup happened, the data is in the bucket.
  • The Percona Backup kubernetes resource have been deleted.
  • The data is still in the bucket.

Can I restore it in some way? The Restore custom resource is no applicable in this case, as gives an error, with Backup <name> not found.

Hello @taglas_tamas ,

please have a look at this doc: Restore backup to a new Kubernetes-based environment - Percona Operator for MongoDB

It boils down to specifying the S3 bucket in the restore.yaml:

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

Please note the following though:

When restoring to a new Kubernetes-based environment, make sure it has a Secrets object with the same user passwords as in the original cluster.

You need to have secrets from your k8s cluster as well.

@Sergey_Pronin

Thank you for your response, I have tried the method you’re suggesting, and here are my findings:

Unfortunately, I could not give a name to the backup that would be used in this situation.
The name of the backup on the storage is a UNIX timestamp, and that gives me more information to maintain, I tried using the key pbmName in the Backup custom resource, but it is not declared in the schema. I think this can be a feature, because it would be more accessible to be able to restore a backup called emergency_backup_before_disaster than 2024-01-30T19:28:05Z.

Another thing, just for your information, I have made the mistake to try to a logical backup as a physical, and the following scenario happened:

  • The backup was requested
  • The MongoDB Server was put in Initializing state
  • All of the Server pods restarted, with pbm-init containers instead of backup-agent containers
  • The mongos pods did not start
  • The state of the MongoDB Server did not change with time

When I deleted the Custom Resrouce, and I redeployed it, it redeployed with the already declared PVCs and the backup was finished though.

Anyway, thanks for the information the issue is solved,