archive_command

A server configuration parameter determining how completed WAL segments are sent to archive storage

archive_command is a server configuration parameter which determines how completed WAL segments are sent to archive storage.

archive_command was added in PostgreSQL 8.0 (commit 66ec2db7).

Diagnosing issues

From PostgreSQL 9.4, the system catalogue view pg_stat_archiver can be used to determine if archive_command is failing.

Precise details of the failure can be found in the PostgreSQL log file and will look something like this:

[2019-06-10 21:51:43 UTC] node2 postgres [unknown] LOCATION:  ProcessStandbyReplyMessage, walsender.c:1788
cp: cannot create regular file "/home/backup/invalid-wal-dir/000000010000000000000001": No such file or directory
[2019-06-10 21:51:44 UTC]    LOG:  00000: archive command failed with exit code 1
[2019-06-10 21:51:44 UTC]    DETAIL:  The failed archive command was:
test ! -f /home/backup/invalid-wal-dir/000000010000000000000001 &&
cp pg_wal/000000010000000000000001 /home/backup/invalid-wal-dir/000000010000000000000001

Categories

Configuration, GUC configuration item, Replication, Storage

See also

archive_mode, pg_stat_archiver