goback postgres
Back up and restore Postgres clusters
Base backups work with Postgres 9.6 and later. Streaming WAL through a replication slot works with Postgres 14 and later. Base backups and WAL go into separate sets.
goback [global flags] postgres <command>postgres base
Section titled “postgres base”Take a base backup and commit it to the set named by –set
base connects with –dbname, or with PGHOST, PGUSER and the other PG* variables. The user needs the REPLICATION attribute. On Postgres 15 and later, goback takes the backup over its own replication connection. On older versions, or with –pg-basebackup, goback runs pg_basebackup to take it.
goback [global flags] postgres base [flags]| Flag | Description | Environment | Default |
|---|---|---|---|
--dbname value |
connection string for the backup | GOBACK_POSTGRES_DBNAME |
|
--pg-basebackup value |
pg_basebackup program to take the backup with; its major version must match the server’s | GOBACK_POSTGRES_BASEBACKUP |
postgres receive
Section titled “postgres receive”Stream the cluster’s WAL through a replication slot and commit it to the set named by –set until SIGTERM
receive connects with –dbname, or with PGHOST, PGUSER and the other PG* variables. The role needs the REPLICATION attribute. pg_hba.conf needs a replication line for the role. It also needs a line for a normal connection to the database in –dbname, which is postgres by default. The slot holds the WAL that the receiver has not committed yet. Set max_slot_wal_keep_size to limit it. Run receive –drop-slot when you retire the receiver.
goback [global flags] postgres receive [flags]| Flag | Description | Environment | Default |
|---|---|---|---|
--spool value |
directory that holds WAL until it is committed | GOBACK_POSTGRES_SPOOL |
|
--base-set value |
set that holds the cluster’s base backups | ||
--dbname value |
connection string for the receiver | GOBACK_POSTGRES_DBNAME |
|
--slot value |
physical replication slot to use; goback_ followed by the set’s name by default | ||
--commit-every value |
how often to commit new WAL; at least 10s | 1m0s |
|
--commit-bytes value |
commit early once this much new WAL has arrived | 256MiB |
|
--window value |
how far back point-in-time recovery reaches; WAL older than the oldest base backup in this window is retired | 336h0m0s |
|
--allow-uncapped-slot |
stream even when max_slot_wal_keep_size does not limit the slot, so the slot can keep WAL until the database’s disk is full | ||
--shutdown-grace value |
how long the last commit may take after SIGTERM | 30s |
|
--drop-slot |
drop the replication slot and exit |
postgres restore
Section titled “postgres restore”Write a base backup into an empty data directory; with –wal-set, Postgres recovers from that WAL when it starts on the directory
With –wal-set, restore sets a restore_command that runs goback for each WAL file Postgres asks for. It runs this binary with the global flags given here, or the command in –goback. The command and its flags go into postgresql.auto.conf, or into recovery.conf before Postgres 12. Settings given as environment variables must also be set in Postgres’s environment. With –copy-wal, restore copies the WAL into pg_wal instead. Postgres then needs neither goback nor the store.
goback [global flags] postgres restore [flags] <data directory>| Flag | Description | Environment | Default |
|---|---|---|---|
--base-set value |
set that holds the cluster’s base backups; a number names the set by id and reads it from the store instead of the index | ||
--wal-set value |
set that holds the cluster’s WAL, for recovering past the end of the base backup; a number names the set by id | ||
--at value |
moment to recover to, in RFC 3339 (2026-10-02T14:30:00Z); the end of the WAL set by default | ||
--goback value |
command that restore_command uses to run goback, including the global flags | ||
--copy-wal |
copy the WAL recovery reads into the data directory instead of fetching it through restore_command |
postgres wal-get
Section titled “postgres wal-get”Write one WAL file from a WAL commit to a path; restore_command runs this
goback [global flags] postgres wal-get [flags] <%f> <%p>| Flag | Description | Environment | Default |
|---|---|---|---|
--wal-set value |
set that holds the WAL commit | ||
--commit value |
ref of the WAL commit, in hex |