Skip to content

Making on-demand backups

To make an on-demand backup manually, you need a backup configuration file. You can use the example of the backup configuration file deploy/backup.yaml :

apiVersion: pgv2.percona.com/v2
kind: PerconaPGBackup
metadata:
  name: backup1
spec:
  pgCluster: cluster1
  repoName: repo1
#  options:
#  - --type=full

Here’s a sequence of steps to follow:

  1. Before you start, make sure you have configured a backup storage.
  2. In the deploy/backup.yaml configuration file, specify the cluster name and the repository name to be used for backups. The repository name must be the same as the one you defined in the backup storage configuration. It must also match the repository name specified in the backups.pgbackrest.manual subsection of the deploy/cr.yaml file.
  3. If needed, you can add any pgBackRest command line options .

  4. Make a backup with the following command (modify the -n postgres-operator parameter if your database cluster resides in a different namespace):

    $ kubectl apply -f deploy/backup.yaml -n postgres-operator
    
    Expected output
    perconapgbackup.pgv2.percona.com/backup1 created
    
  5. Making a backup takes time. You can track the process with kubectl get pg-backup command. When finished, backup should obtain the Succeeded status:

    $ kubectl get pg-backup backup1 -n postgres-operator
    
    Expected output
    NAME      CLUSTER    REPO    DESTINATION   STATUS      TYPE   COMPLETED   AGE
    backup1   cluster1   repo1                 Succeeded   incr   3m38s       3m53s
    

Tip

To list available backups, run:

$ kubectl get pg-backup -n postgres-operator

Next steps

Restore from a backup

Backup retention

Get expert help

If you need assistance, visit the community forum for comprehensive and free database knowledge, or contact our Percona Database Experts for professional support and services. Join K8S Squad to benefit from early access to features and “ask me anything” sessions with the Experts.


Last update: 2024-11-25