WarehousePG Disaster Recovery configuration files

The backup configuration file is used when setting up the primary cluster, and the restore configuration file is used when preparing the DR cluster. The global configuration file sets host-level defaults shared across both.

Backup configuration YAML

Used with whpg-dr configure backup. Contains the cluster name, storage backend, and optional Barman tuning. See Configuring the primary cluster for setup instructions.

# Required
cluster_name: <string>

storage:
  type: posix | s3

  # POSIX fields
  path: <absolute-path>

  # S3 fields
  bucket: <string>
  prefix: <string>
  region: <string>
  credential_source: static | default   # optional; inferred from access_key_id when omitted
  profile: <string>               # optional; AWS credentials profile name (default: whpg-dr)
  endpoint_url: <url>             # optional; omit for AWS S3
  local_staging: <absolute-path>  # optional; local path for WAL staging (S3 only)
  access_key_id: <string>         # optional; inline credentials (implies credential_source: static)
  secret_access_key: <string>     # optional; required with access_key_id
  session_token: <string>         # optional; for temporary STS credentials only

# Optional
whpg_dr_home: <absolute-path>    # overrides WHPG_DR_HOME env var
ssh_user: <string>                # default: $USER
pg_user: <string>                 # default: ssh_user

barman_options:
  compression: gzip | bzip2 | zstd | none
  compression_level: low | medium | high
  network_compression: "on" | "off"  # POSIX only
  retention_policy: REDUNDANCY <n> | RECOVERY WINDOW OF <n> DAYS|WEEKS|MONTHS
  minimum_redundancy: <integer>
  jobs: <integer>                 
  max_archive_size: <size> # S3 only       
FieldRequiredDescription
cluster_nameYesUnique name for the cluster. Used as the namespace for all artifacts in the storage repository.
storage.typeYesStorage backend type.
storage.pathIf POSIXAbsolute path to the backup directory. Must be reachable from all segment hosts.
storage.bucketIf S3S3 bucket name. The bucket must already exist.
storage.prefixIf S3Path prefix within the bucket for this cluster's data.
storage.regionIf S3AWS region or region configured on the S3-compatible store.
storage.credential_sourceNoHow credentials are provided. static distributes inline keys to all segment hosts. default uses the AWS credential chain on each host. Inferred from access_key_id when omitted.
storage.profileNoAWS credentials profile name. Defaults to whpg-dr when credential_source: static. When credential_source: default, references a named profile in each host's ~/.aws files.
storage.endpoint_urlNoCustom endpoint URL for S3-compatible stores. Omit for AWS S3.
storage.access_key_idNoAWS access key ID. Required together with secret_access_key; implies credential_source: static.
storage.secret_access_keyNoAWS secret access key. Required together with access_key_id.
storage.session_tokenNoTemporary STS session token. Requires access_key_id and secret_access_key. Tokens expire and aren't refreshed; use credential_source: default with an instance role instead.
storage.local_stagingNoLocal path for WAL staging during S3 uploads. S3 storage only.
whpg_dr_homeNoOverride for WHPG_DR_HOME. Defaults to $HOME/.whpg-dr.
ssh_userNoOS user for SSH connections to segment hosts. Defaults to $USER.
pg_userNoPostgres user for Barman's connections to segments. Defaults to ssh_user.
barman_options.compressionNoCompression algorithm for WAL archiving.
barman_options.compression_levelNoCompression level for WAL archiving.
barman_options.network_compressionNoEnable rsync network compression. POSIX storage only.
barman_options.retention_policyNoRetention policy for base backups. Accepts REDUNDANCY <n> to keep the n most recent backups, or RECOVERY WINDOW OF <n> DAYS|WEEKS|MONTHS to keep backups within a time window.
barman_options.minimum_redundancyNoMinimum number of backups to retain regardless of the retention policy. Don't set to a value greater than 0 until at least one backup exists, or whpg-dr check fails.
barman_options.jobsNoNumber of parallel workers per segment. Defaults to 1. The --barman-jobs flag on whpg-dr backup overrides this value per run. Raise it to increase parallelism, sizing it as approximately host_cores / primaries_per_host. It's most impactful for S3 storage, where upload concurrency is often the bottleneck.
barman_options.max_archive_sizeNoS3 storage only. Set to a smaller archive size to reduce the impact of transient network errors on large restores. Use alongside barman_options.jobs to improve backup throughput. Accepts an integer with an optional case-sensitive suffix k, Ki, M, Mi, G, Gi, T, or Ti, for example 10Gi.

Examples

POSIX storage:

cluster_name: my_cluster

storage:
  type: posix
  path: /data/backups

barman_options:
  compression: zstd
  compression_level: medium
  network_compression: "on"

S3 storage:

cluster_name: my_cluster

storage:
  type: s3
  bucket: my-backup-bucket
  prefix: whpg
  region: us-east-1
  profile: whpg-dr

barman_options:
  compression: zstd
  compression_level: medium
  retention_policy: RECOVERY WINDOW OF 4 WEEKS
  minimum_redundancy: 1
  jobs: 4                          
  max_archive_size: 10Gi           

Restore configuration YAML

Used with whpg-dr configure restore. Describes the storage repository and the DR cluster's topology. See Setting up the DR cluster for setup instructions.

# Required
source_cluster_name: <string>

storage:
  # Same structure as backup YAML storage block

coordinator_host: <string>
coordinator_data_directory: <absolute-path>

segment_hosts:
  - <hostname>
  - ...

# A single base path, or a list of mount-point directories;
# segments are spread across the list round-robin per host
data_directory: <absolute-path>
# or:
# data_directory:
#   - <absolute-path>
#   - <absolute-path>
data_directory_prefix: <string>

# Optional — per-host override; same shape as data_directory (path or list)
data_directory_overrides:
  <hostname>: <absolute-path>
  <hostname>: [<absolute-path>, <absolute-path>]

coordinator_port: <integer>       # optional; default from backup's segment_configuration.csv
segment_port_base: <integer>      # optional; default from backup's segment_configuration.csv

whpg_dr_home: <absolute-path>
ssh_user: <string>
pg_user: <string>

barman_options:
  compression: gzip | bzip2 | zstd | none
  compression_level: low | medium | high
  network_compression: "on" | "off"  # POSIX only
  jobs: <integer>                 
  wal_prefetch: <integer>         
FieldRequiredDescription
source_cluster_nameYesThe cluster_name from the backup YAML. Used to locate the cluster's data in the storage repository.
storageYesSame structure as the backup configuration YAML. Must point to the same repository the primary writes to.
coordinator_hostYesHostname of the DR coordinator.
coordinator_data_directoryYesAbsolute path for the coordinator data directory on the DR coordinator host.
segment_hostsYesHostnames of the DR segment hosts. The count doesn't need to match the source, but can't exceed the number of primary segments in the backup.
data_directoryYesBase path for segment data directories on DR segment hosts. Accepts a single absolute path or a list of mount-point directories; when a list is given, segments are spread across the paths round-robin. Doesn't need to match the primary's layout.
data_directory_prefixYesPrefix for segment directory names. Combined with data_directory and the content ID to form the full path.
data_directory_overridesNoPer-host override for data_directory, for DR hosts whose disk layout differs from the rest. Each value takes the same shape as data_directory, either a single path or a list of mount-point directories. Every key must appear in segment_hosts; hosts not listed use the global data_directory.
coordinator_portNoCoordinator port on the DR cluster. Defaults to the value recorded in the backup's segment_configuration.csv.
segment_port_baseNoBase port for segments. Segment N uses segment_port_base + N. Defaults to the value recorded in the backup's segment_configuration.csv.
barman_optionsNoBarman tuning for the restore side. Shared fields (compression, network_compression) must match the backup configuration.
barman_options.jobsNoNumber of parallel workers per segment. Defaults to 1. The --barman-jobs flag on whpg-dr restore overrides this value per run. Raise it to increase parallelism, sizing it as approximately host_cores / primaries_per_host. It's most impactful for S3 storage, where download concurrency is often the bottleneck.
barman_options.wal_prefetchNoNumber of WAL files to fetch in parallel ahead of replay during restore. Distinct from jobs, which parallelizes the base-backup copy. 0 or unset disables prefetching.
whpg_dr_homeNoOverride for WHPG_DR_HOME on the DR cluster.
ssh_userNoOS user for SSH connections to DR segment hosts. Defaults to $USER.
pg_userNoPostgres user for Barman connections. Defaults to ssh_user.

Examples

POSIX storage:

source_cluster_name: my_cluster

storage:
  type: posix
  path: /data/backups

coordinator_host: new-coordinator
coordinator_data_directory: /data/coordinator

segment_hosts:
  - new-segment-host-1
  - new-segment-host-2
  - new-segment-host-3
  - new-segment-host-4

data_directory: /data/primary
data_directory_prefix: gpseg

barman_options:
  compression: zstd
  compression_level: medium
  network_compression: "on"

S3 storage:

source_cluster_name: my_cluster

storage:
  type: s3
  bucket: my-backup-bucket
  prefix: whpg
  region: us-east-1
  profile: whpg-dr

coordinator_host: new-coordinator
coordinator_data_directory: /data/coordinator

segment_hosts:
  - new-segment-host-1
  - new-segment-host-2
  - new-segment-host-3
  - new-segment-host-4

data_directory: /data/primary
data_directory_prefix: gpseg

barman_options:
  compression: zstd
  compression_level: medium

Multi-mount POSIX storage (segments spread across three mount points per host):

source_cluster_name: my_cluster

storage:
  type: posix
  path: /data/backups/whpg-dr

coordinator_host: cdw-dr
coordinator_data_directory: /data/coordinator

segment_hosts:
  - sdw1-dr
  - sdw2-dr

data_directory:
  - /data1/primary
  - /data2/primary
  - /data3/primary
data_directory_prefix: gpseg

Resulting layout with six primary segments across two hosts:

Content IDHostSegment data directory
0sdw1-dr/data1/primary/gpseg0
1sdw1-dr/data2/primary/gpseg1
2sdw1-dr/data3/primary/gpseg2
3sdw2-dr/data1/primary/gpseg3
4sdw2-dr/data2/primary/gpseg4
5sdw2-dr/data3/primary/gpseg5

A full runnable example ships as examples/restore/posix-multi-mount-data-directories.yaml.


global.yaml

The host-level defaults file at $WHPG_DR_HOME/global.yaml sets values that apply to all clusters on the host. Per-cluster YAML settings override these defaults. See Customizing the home directory for context.

log_dir: <absolute-path>          # default: $HOME/gpAdminLogs
log_file_level: debug | info | warn | error | fatal
ssh_user: <string>
pg_user: <string>

All fields are optional. Example:

log_dir: /var/log/whpg-dr
log_file_level: debug
ssh_user: gpadmin
pg_user: gpadmin

Could this page be better? Report a problem or suggest an addition!