Skip to main content
PGO supports several patterns for recovering data and restoring service after failures. You can restore a cluster in place using the existing backup infrastructure, bootstrap an entirely new cluster from a pgBackRest backup or an existing cluster, perform point-in-time recovery to any moment covered by WAL archives, or run a live standby cluster that can be promoted with a single spec change. This page covers each pattern with working YAML examples derived directly from the operator’s spec.

In-place restore

An in-place restore re-initializes a running PostgresCluster from one of its own pgBackRest repositories. The cluster is shut down, the data directory is cleared, and pgBackRest restores the selected backup.
1

Enable the restore in the spec

Set spec.backups.pgbackrest.restore.enabled: true and specify the source repo.
2

Apply the manifest

The operator creates a restore Job. Monitor its progress:
3

Disable the restore after completion

Once the restore is complete, set enabled: false to prevent accidental re-execution on the next reconcile.
An in-place restore is destructive. All data in the cluster is overwritten. Confirm you are targeting the correct cluster and backup before applying.

Point-in-time recovery (PITR)

PITR lets you restore to any moment covered by continuous WAL archives in your pgBackRest repository. Pass pgBackRest restore options through spec.backups.pgbackrest.restore.options.
The --target-action=promote option tells PostgreSQL to promote the instance to read-write once it reaches the target recovery time. Without it, the instance remains in recovery and accepts no writes.
Available --type options match pgBackRest’s restore command:

Bootstrap a new cluster from backup

spec.dataSource lets you pre-populate a brand-new PostgresCluster with data from a pgBackRest repository before the cluster accepts connections. This is the recommended way to stand up a clone or a replacement cluster from an off-site backup.
Use spec.dataSource.pgbackrest to restore from S3, GCS, or Azure into a new cluster. This is the only data source option that works with cloud (non-volume) repositories.

PITR when bootstrapping a new cluster

You can combine spec.dataSource with a point-in-time target by passing pgBackRest options through the options field.

Clone a cluster using existing volumes

If you have PVCs from a stopped or deleted cluster, you can reuse them directly with spec.dataSource.volumes. This avoids a full backup-based restore and is faster for large datasets.
The source PVCs must not be mounted by any running pods. Stop or delete the source cluster before reusing its volumes.

Standby cluster for live DR

A standby cluster continuously streams WAL from a pgBackRest repository and can be promoted to an independent primary at any time. This provides near-zero RPO for cross-cluster or cross-region disaster recovery.

Promote the standby

To take over traffic after a primary-side failure or for a planned migration:
1

Set standby.enabled to false

2

Apply the manifest

PGO stops WAL replay and Patroni promotes one instance to primary. The cluster will begin accepting writes.
3

Update your application's connection string

Point your application to the new primary’s Service (hippo-dr-primary) or pgBouncer endpoint.
If the original primary cluster is still running when you promote the standby, you will have two writable clusters pointing at the same data. Ensure the original primary is offline or network-isolated before promoting the standby to avoid a split-brain scenario.

Verify recovery

After any restore or clone operation, confirm data integrity before returning to production traffic:

Backups

Configure pgBackRest repos, schedules, and retention before a restore is needed.

High availability

Set up Patroni-managed automatic failover within a single cluster.

Create a cluster

Bootstrap a fresh PostgresCluster with the right storage configuration.

Custom Resource Reference

Full field reference for spec.dataSource, spec.standby, and spec.backups.pgbackrest.restore.