Update howto/postgresql recovery procedure
The current recovery steps in the wiki don't work for PostgreSQL version 12 and later.
This is because recovery.conf
in the database directory is no longer supported. The restore_command
config must be placed in postgresql.conf
.
Nov 01 22:25:43 rude postgresql@15-main[30560]: 2023-11-01 22:25:43 UTC [30565-1] LOG: starting PostgreSQL 15.3 (Debian 15.3-0+deb12u1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
Nov 01 22:25:43 rude postgresql@15-main[30560]: 2023-11-01 22:25:43 UTC [30565-2] LOG: listening on IPv4 address "0.0.0.0", port 5432 Nov 01 22:25:43 rude postgresql@15-main[30560]: 2023-11-01 22:25:43 UTC [30565-3] LOG: listening on IPv6 address "::", port 5432
Nov 01 22:25:43 rude postgresql@15-main[30560]: 2023-11-01 22:25:43 UTC [30565-4] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
Nov 01 22:25:43 rude postgresql@15-main[30560]: 2023-11-01 22:25:43 UTC [30568-1] LOG: database system was interrupted; last known up at 2023-11-01 18:52:52 UTC
Nov 01 22:25:43 rude postgresql@15-main[30560]: 2023-11-01 22:25:43 UTC [30568-2] FATAL: using recovery command file "recovery.conf" is not supported
Nov 01 22:25:43 rude postgresql@15-main[30560]: 2023-11-01 22:25:43 UTC [30565-5] LOG: startup process (PID 30568) exited with exit code 1
Nov 01 22:25:43 rude postgresql@15-main[30560]: 2023-11-01 22:25:43 UTC [30565-6] LOG: aborting startup due to startup process failure
Nov 01 22:25:43 rude postgresql@15-main[30560]: 2023-11-01 22:25:43 UTC [30565-7] LOG: database system is shut down
From the 12.0 release notes:
recovery.conf is no longer used, and the server will not start if that file exists. recovery.signal and standby.signal files are now used to switch into non-primary mode.
In addition, after adding the restore directive, a restore.signal
file must be create din the database directory to trigger the recovery process.
Nov 01 22:33:31 rude postgresql@15-main[31198]: 2023-11-01 22:33:31 UTC [31203-1] LOG: starting PostgreSQL 15.3 (Debian 15.3-0+deb12u1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
Nov 01 22:33:31 rude postgresql@15-main[31198]: 2023-11-01 22:33:31 UTC [31203-2] LOG: listening on IPv4 address "0.0.0.0", port 5432
Nov 01 22:33:31 rude postgresql@15-main[31198]: 2023-11-01 22:33:31 UTC [31203-3] LOG: listening on IPv6 address "::", port 5432
Nov 01 22:33:31 rude postgresql@15-main[31198]: 2023-11-01 22:33:31 UTC [31203-4] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
Nov 01 22:33:31 rude postgresql@15-main[31198]: 2023-11-01 22:33:31 UTC [31206-1] LOG: database system was interrupted; last known up at 2023-11-01 18:52:52 UTC
Nov 01 22:33:31 rude postgresql@15-main[31198]: 2023-11-01 22:33:31 UTC [31206-2] LOG: invalid checkpoint record
Nov 01 22:33:31 rude postgresql@15-main[31198]: 2023-11-01 22:33:31 UTC [31206-3] FATAL: could not locate required checkpoint record
Nov 01 22:33:31 rude postgresql@15-main[31198]: 2023-11-01 22:33:31 UTC [31206-4] HINT: If you are restoring from a backup, touch "/var/lib/postgresql/15/main/recovery.signal" and add required recovery options.
Nov 01 22:33:31 rude postgresql@15-main[31198]: If you are not restoring from a backup, try removing the file "/var/lib/postgresql/15/main/backup_label".
Nov 01 22:33:31 rude postgresql@15-main[31198]: Be careful: removing "/var/lib/postgresql/15/main/backup_label" will result in a corrupt cluster if restoring from a backup.
Nov 01 22:33:31 rude postgresql@15-main[31198]: 2023-11-01 22:33:31 UTC [31203-5] LOG: startup process (PID 31206) exited with exit code 1
Nov 01 22:33:31 rude postgresql@15-main[31198]: 2023-11-01 22:33:31 UTC [31203-6] LOG: aborting startup due to startup process failure
Nov 01 22:33:31 rude postgresql@15-main[31198]: 2023-11-01 22:33:31 UTC [31203-7] LOG: database system is shut down