pg_backup_and_purge: Take backups on replicas, if present.

Taking backups on the database primary adds additional disk load,
which can impact the performance of the application.

Switch to taking backups on replicas, if they exist.  Some deployments
may have multiple replicas, and taking backups on all of them is
wasteful and potentially confusing; add a flag to inhibit taking
nightly snapshots on the host.

If the deployment is a single instance of PostgreSQL, with no
replicas, it takes backups as before, modulo the extra flag to allow
skipping taking them.
This commit is contained in:
Alex Vandiver
2023-04-26 01:21:36 +00:00
committed by Tim Abbott
parent 4b35211ca1
commit 19a11c9556
3 changed files with 66 additions and 13 deletions

View File

@@ -836,6 +836,14 @@ based on the `pg_hba.conf` file; if you are using password
authentication, you can set a `postgresql_replication_password` secret
for authentication.
#### `skip_backups`
If set to as true value, inhibits the nightly [`wal-g` backups][wal-g] which
would be taken on all non-replicated hosts and [all warm standby
replicas](#postgresql-warm-standby). This is generally only set if you have
multiple warm standby replicas, in order to avoid taking multiple backups, one
per replica.
#### `ssl_ca_file`
Set to the path to the PEM-encoded certificate authority used to