whpg-backup provides the gpbackup and gprestore utilities. Build them from source, then install the binaries on every host in your WarehousePG cluster.
Prerequisites
- Build host: Go 1.23 or later, plus
sqlite3. Building directly on the WarehousePG coordinator avoids a cross-compile step, since it's already running the same OS as your segment hosts. If you build on a macOS workstation instead, usemake build_linuxto cross-compile for the cluster. - Every host in the cluster:
sqlite3.gpbackupsplits work between the coordinator and every segment host, so thesqlite3runtime dependency needs to be present wherevergpbackup,gprestore, orgpbackup_helperruns, not just on the build host.
Building from source
Clone the repository and change into it:
bashgit clone https://github.com/warehouse-pg/whpg-backup.git cd whpg-backupBuild the
gpbackup,gprestore, andgpbackup_helperbinaries:bashmake depend make buildThe binaries are placed in
$HOME/go/bin. If you're cross-compiling from a macOS workstation, runmake build_linuxinstead.
TIP
Add $HOME/go/bin to your PATH so you can run the binaries directly from the build host:
export PATH=$PATH:$HOME/go/binInstalling on the cluster
Confirm
sqlite3is installed on every host in the cluster, including the coordinator, standby coordinator, and all segment hosts. It's installed by default on many platforms, but install it if it's missing.On the coordinator, create a file
all_hostswhich lists all hosts in the WHPG cluster. For example:inicdw scdw sdw1 sdw2 sdw3Transfer the binaries to all hosts in the cluster and place them on
$PATH, for example in$GPHOME/bin. Use thegpsyncutility on WarehousePG 7, or thegpscputility on WarehousePG 6:WHPG 7
bashgpsync -f all_hosts $HOME/go/bin/gpbackup $HOME/go/bin/gprestore $HOME/go/bin/gpbackup_helper =:$GPHOME/binWHPG 6
bashgpscp -f all_hosts $HOME/go/bin/gpbackup $HOME/go/bin/gprestore $HOME/go/bin/gpbackup_helper =:$GPHOME/binVerify the installation by checking the
gpbackupandgprestoreversions:bashgpbackup --version gprestore --version
Upgrading
To upgrade to a new release, rebuild gpbackup, gprestore, and gpbackup_helper from the release tag you want, then redistribute them to every host the same way as a fresh install.
In your existing clone, fetch the latest tags and check out the release you want to upgrade to. Replace
<tag>with the release tag, for example1.34.0-WHPG:bashgit fetch --tags git checkout <tag>Rebuild the binaries:
bashmake depend make buildTransfer the rebuilt binaries to every host in the cluster, overwriting the existing ones. Use the same
gpsyncorgpscpcommand as in Installing on the cluster.Verify the upgrade by checking the version on the coordinator:
bashgpbackup --version gprestore --version
Note
gpbackup and gprestore are command-line utilities, not a running service, so there's nothing to stop or restart. Avoid upgrading while a backup or restore is in progress.
