Data recovery and Cloning
Backups in PostgreSQL application
Starting from v26.2.0 application version, you have a granular control over backup system for PostgreSQL. You can configure frequency and number of backups to keep. You can also rollout database from historical snapshot. Depending on how you use Apolo, you might also have the ability to manually trigger backups and perform in-place data recovery (otherwise, you need to perform database cloning).
On this page, we discuss the following actions that you can perform with the application:
Data recovery overview
Cloning the database with various data recovery scenarios
Triggering backup manually (requires virtual Kubernetes in your Apolo project)
Restoring data
When it comes to data restore, you have several options:
PITR (point-int-time-recovery): revert data state to a snapshot before changes occurred
In-Place PITR: performs PITR on a currently running database (potentially, destructive operation)
One can also clone database from backup in object store: deploys a new database instance, seed it with data stored in a backup. This can be combined with the first PITR option.
More details for each of the approaches can be found here.
Within Apolo platform, we allow our users to clone database from available backups, instead of doing in-place PITRs which considered to be a destructive operation.
In case of absolute need, you can also perform in-pace PITRs (if virtual Kubernetes enabled in your project), otherwise, reach out to the support team with the corresponding request.
PostgreSQL clone
Apolo provides several database cloning options, depending on your data recovery requirements. Each approach involves creating a new PostgreSQL application instance and configuring its data source to use the Blob storage that contains backups of the original PostgreSQL instance.
For instance, you have/had other PostgreSQL application that you want to clone from. This instance should have backups enabled. In it's outputs, you will find the info about backup Bucket: ID, owner and provider. Note them down, since we it will be needed for cloning.
By specifying source.pgbackrest_options input parameter for a new PostgreSQL app, you can control if and how PITR is performed during the database rollout. You can find overview of options here.
Below you will find examples that various cloning strategies and how it influences PostgreSQL app. For each case, you have Apolo platform application configuration and a corresponding postgrescluster Kubernetes CRD snippet.
Clone to latest
Cloning when no PITR is enabled.
What it does:
Selects the most recent full backup available
Applies any differential/incremental backups that follow it
Replays ALL available WAL files up to the most recent one in the archive
Results in the absolute latest state of your database
Use Case:
You want the most up-to-date data possible
Typical disaster recovery scenario
Cloning production to staging with latest data
Install the database instance, wait till it finishes installation.
Now you have a fresh copy of your database + most recent transactions stored in WAL files in backup object store.
Clone to snapshot
Cloning from a specified full backup.
What it does:
Restores only the specified backup (e.g.,
20251215-145459F)Does NOT replay any WAL files
Stops immediately after the backup is restored
Results in database state exactly as it was when that backup finished
Use Case:
You want a specific snapshot in time
Creating test datasets from a known backup
You don't need the latest data, just a consistent snapshot
Faster restore (no WAL replay)
Install the database instance, wait till it finishes installation.
Now you have a database instance rolled out from your full (hence suffix F) backup performed at 2026-02-13-09:31:31. All changes made in the database after this backup are not present in clone.
You can also perform a restore from a differential backup. In order to find your backups information, follow the instruction from Identifying backups.
Clone with point-in-time-recovery
PITR allows you to recover your database to the specified timestamp. Imagine some database table was accidentally dropped / truncated, or the migration did not go well. PITR is designed to rescue in such cases.
Before performing PITR:
You must have a backup that finished BEFORE your target time - you cannot restore to a time before your first backup. For this, ensure you have configured corresponding backup schedule.
All relevant WAL files must be successfully pushed to the repository. To check this, read logs of pgBackRest container.
In Apolo PostgreSQL database application for now, PITR is considered to be used together with database cloning. However, if you need to perform in-place PITR, reach out to support team.
Clone from backup and perform point-in-time-recovery, time is set to specific timestamp 2026-02-14 14:30:00+00.
What it does:
Automatically selects the most recent full backup completed before
2026-02-14 14:30:00+00Applies any differential/incremental backups from that backup set (if they're also before the target time)
Replays WAL files from the last backup up to exactly
2026-02-14 14:30:00+00Stops recovery at the precise moment specified (down to the second)
Results in database state exactly as it was at 2026-02-14 14:30:00 UTC
Use Case:
Recovery from accidental data deletion/corruption (restore to just before the incident)
Compliance/audit requirements (restore database to specific point for investigation)
Testing "what-if" scenarios (see database state at a particular business moment)
Recovering from a failed deployment/migration (go back to before the change)
More precise than a backup snapshot, but slower than
--type=immediate(due to full WAL replay)
Install the database instance, wait till it finishes installation.
Now you have a database instance rolled out from your full backup performed before 2026-02-14 14:48:00+00 + all transactions happened between full backup capture and specified time are reapplied. Every change that happened after this time is not present in the database clone.
Triggering manual backup
Currently, you can only perform this action if your Apolo project has virtual Kubernetes enabled, since you need to have a direct access to the virtual cluster with the application installed.
If you don't have virtual Kubernetes enabled, but still need to perform ad-hoc backup, contact the support team.
To trigger a manual backup of PostgreSQL cluster perform following actions:
Identify your
postgresclusterCRD name. For this, use your virtual Kubernetes credentials and performkubectl get postgrescluster. Sample output:
Enable manual backups by patching
postgresclusterCRD. Add the following configuration:
This instructs pgBackRest to perform a full backup of your database into the previously configured backup repo (repo1, added by Apolo during app installation).
Trigger backup by adding annotation to your
postgresclusterCRD
Check that backup job started and completed successfully:
This is it, you manual backup data will be stored in the corresponding backup bucket.
Identifying backups
Overall goal here is to configure and run dedicated pgbackrest tool within a job. The configuration approach highly depends on what backup object store you use. In Apolo you have multiple object store options and here are highlights for most common of them. Consult pgbackrest documentation if if you cannot find needed example here.
Configuring pgbackrest:
Create dedicated credentials for backup bucket via
apolo blob mkcredentials <bucket>Store access key id and secret access key and to access the bucket as secrets:
apolo secret add KEY_ID <key-id-from-mkcredentials>apolo secret add SECRET_KEY <key-id-from-mkcredentials>
Run job mounting those secrets as pgbackrest's repo1 config params:
Create dedicated credentials for backup bucket via
apolo blob mkcredentials <bucket>Store credentials as secret:
base64 -ddata fromkey_dataand put it into theREPO_ACCESS_DATAsecret:
echo <key_data_from_mkcredentials> | base64 -d > key_data && apolo secret add REPO_ACCESS_DATA @key_data
Attach this secret key file
apolo run -v secret:GCS_KEY_DATA:/tmp/creds ubuntu -- bash
Run a job with credentials attached from instructions above
Within job: install pgbackrest tool, also install ca-certificates
Configure pgbackrest tool:
Note: S3 Endpoint, region and bucket name are displayed in the output of mkcredentials command.
Note: ensure repo1-path is correct by confirming via apolo blob ls blob:<bucketURI>/... . It should contain archive/ and backup/ subpaths. Bucket name is the name in source system, reported to you during bucket creation or via apolo blob statbucket command.
List backups with
pgbackrest infocommand. Sample output:
With this information you can clone your database and perform PITR / or specific backup rollout.
Summary
Apolo's PostgreSQL application backup support provides:
Flexibility: Choose between latest data, specific snapshots, or precise timestamps
Safety: Clone-based approach prevents accidental data loss
Compliance: Meet audit requirements with point-in-time recovery
Control: Manual triggers for critical moments, automated schedules for routine protection
Speed Options: Trade-off between restore speed and data freshness based on your needs
References
Last updated
Was this helpful?