Point In Time Recovery tools for PostgreSQL

Workaround for restore_xlog failing over SSH

15 Oct 2015

The default restore_command generated by the restore action does not work when archiving is done over SSH.

restore_xlog fails to find the SSH user and host from the configuration file, when it is not provided on the command line. As of 1.9, the restore action no longer generates a restore_xlog command line including -h or -u for restore_command in recovery.conf.

This make the restore fail when PostgreSQL starts.

The workaround is to set RESTORE_COMMAND in the configuration file to:

RESTORE_COMMAND="/path/to/restore_xlog -C <config_file> -h <archive_host> %f %p"

If a different SSH user is required, add -u:

RESTORE_COMMAND="/path/to/restore_xlog -C <config_file> -h <archive_host> -u <archive_user> %f %p"

This issue is old, but it is only when the behaviour of the restore action on generating the value of restore_command has been changed in version 1.9 that it shows.

The next version of pitrery, 1.10 will include a fix for this bug. In the mean time, see issue 6 on github.