Make on-demand backup¶
Before you begin¶
-
Export the namespace as an environment variable. Replace the
<namespace>placeholder with your value:export NAMESPACE=<namespace> -
Check the configuration of the
PerconaXtraDBClusterCustom Resource. Verify that you have configured backup storage and specified its configuration in thebackup.storagessubsection of the Custom Resource.
Backup steps¶
To make an on-demand backup, use a special backup configuration YAML file. The example of such file is deploy/backup/backup.yaml
-
Specify the following keys
- Set the
metadata.namekey to assign a name to the backup. You will use it to make a restore - Set the
spec.pxcClusterkey to the name of your cluster - Set the
spec.storageNamekey to a storage configuration defined in yourdeploy/cr.yamlfile. - Optionally, add the
percona.com/delete-backupentry undermetadata.finalizersto enable deletion of backup files from a backup storage when the backup object is removed (manually or by schedule).
Here’s the example configuration:
apiVersion: pxc.percona.com/v1 kind: PerconaXtraDBClusterBackup metadata: finalizers: - percona.com/delete-backup name: backup1 spec: pxcCluster: cluster1 storageName: fs-pvc - Set the
-
Start the backup process:
kubectl apply -f deploy/backup/backup.yaml -n $NAMESPACE
Verify the backup¶
-
Track the backup process by checking the status of the Backup object:
kubectl get pxc-backup -n $NAMESPACE -wThe
-wflag instructs the Operator to provide real-time updates about the backup progress. TheSucceededstatus indicates that a backup is completed.Expected output
NAME CLUSTER STORAGE DESTINATION STATUS COMPLETED AGE backup1 cluster1 fs-pvc pvc/xb-backup1-20251201102237-8f7b3390 Succeeded 3s 76s -
View detailed information about the backup using the
kubectl describecommand:kubectl describe pxc-backup -n $NAMESPACEThe
Statussection of the output provides useful details about the backup state, the error message in case of issues with the backup, and the storage details.Sample output
Name: backup1 Namespace: <my-namespace> Labels: <none> Annotations: <none> API Version: pxc.percona.com/v1 Kind: PerconaXtraDBClusterBackup Metadata: Creation Timestamp: 2025-12-01T10:22:37Z Generation: 1 Resource Version: 1764584633525183013 UID: 8f7b3390-fa7a-4c37-85f2-9037c093589f Spec: Pxc Cluster: cluster1 Storage Name: fs-pvc Status: Completed: 2025-12-01T10:23:50Z Destination: pvc/xb-backup1-20251201102237-8f7b3390 Image: perconalab/percona-xtradb-cluster-operator:main-pxc8.0-backup Pvc: Access Modes: ReadWriteOnce Resources: Requests: Storage: 6G Storage Class Name: standard-rwo Volume Mode: Filesystem Volume Name: pvc-5238d6db-f40a-4608-8f8e-d0d74f328de9 -
If the cluster has point-in-time recovery enabled, also confirm the backup doesn’t have binlog gaps before relying on it for a PITR restore. Check the Backup object’s
status.conditionsfor aPITRReadycondition set toFalse— see Binlog gaps for what this means and how to proceed anyway if needed.
Created: July 4, 2023