Skip to content

Installing WarehousePG Backup and Restore

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, use make build_linux to cross-compile for the cluster.
  • Every host in the cluster: sqlite3. gpbackup splits work between the coordinator and every segment host, so the sqlite3 runtime dependency needs to be present wherever gpbackup, gprestore, or gpbackup_helper runs, not just on the build host.

Building from source

  1. Clone the repository and change into it:

    bash
    git clone https://github.com/warehouse-pg/whpg-backup.git
    cd whpg-backup
  2. Build the gpbackup, gprestore, and gpbackup_helper binaries:

    bash
    make depend
    make build

    The binaries are placed in $HOME/go/bin. If you're cross-compiling from a macOS workstation, run make build_linux instead.

TIP

Add $HOME/go/bin to your PATH so you can run the binaries directly from the build host:

bash
export PATH=$PATH:$HOME/go/bin

Installing on the cluster

  1. Confirm sqlite3 is 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.

  2. On the coordinator, create a file all_hosts which lists all hosts in the WHPG cluster. For example:

    ini
    cdw
    scdw
    sdw1
    sdw2
    sdw3
  3. Transfer the binaries to all hosts in the cluster and place them on $PATH, for example in $GPHOME/bin. Use the gpsync utility on WarehousePG 7, or the gpscp utility on WarehousePG 6:

    WHPG 7

    bash
    gpsync -f all_hosts $HOME/go/bin/gpbackup $HOME/go/bin/gprestore $HOME/go/bin/gpbackup_helper =:$GPHOME/bin

    WHPG 6

    bash
    gpscp -f all_hosts $HOME/go/bin/gpbackup $HOME/go/bin/gprestore $HOME/go/bin/gpbackup_helper =:$GPHOME/bin
  4. Verify the installation by checking the gpbackup and gprestore versions:

    bash
    gpbackup --version
    gprestore --version