diff --git a/doc/src/sgml/pgstandby.sgml b/doc/src/sgml/pgstandby.sgml index 81e53b6a63..87ba1fcad2 100644 --- a/doc/src/sgml/pgstandby.sgml +++ b/doc/src/sgml/pgstandby.sgml @@ -1,4 +1,4 @@ - + pg_standby @@ -93,20 +93,20 @@ pg_standby option ... archiv the archivelocation directory must be writable too. - There are two ways to fail over a warm standby database server. - You control the type of failover with the contents of the trigger file: + There are two ways to fail over to a warm standby database server + when the master server fails: Smart Failover - In smart failover, the server is brought up after applying all - WAL files available in the archive. This results in zero data loss, - even if the standby server has fallen behind, but if there is a lot - unapplied WAL the recovery can take a long time. To trigger a smart - failover, create a trigger file containing the word smart, - or just leave it empty. + In smart failover, the server is brought up after applying all WAL + files available in the archive. This results in zero data loss, even if + the standby server has fallen behind, but if there is a lot of + unapplied WAL it can be a long time before the standby server becomes + ready. To trigger a smart failover, create a trigger file containing + the word smart, or just create it and leave it empty. @@ -117,7 +117,10 @@ pg_standby option ... archiv In fast failover, the server is brought up immediately. Any WAL files in the archive that have not yet been applied will be ignored, and all transactions in those files are lost. To trigger a fast failover, - write the word fast into the trigger file. + create a trigger file and write the word fast into it. + pg_standby can also be configured to execute a fast + failover automatically if no new WAL file appears within a defined + interval. @@ -208,7 +211,7 @@ pg_standby option ... archiv -t triggerfile none - Specify a trigger file whose presence should perform failover. + Specify a trigger file whose presence should cause failover. It is recommended that you use a structured filename to avoid confusion as to which server is being triggered when multiple servers exist on the same system; for example @@ -240,6 +243,7 @@ pg_standby option ... archiv archive_command = 'cp %p .../archive/%f' restore_command = 'pg_standby -l -d -s 2 -t /tmp/pgsql.trigger.5442 .../archive %f %p %r 2>>standby.log' + recovery_end_command = 'rm -f /tmp/pgsql.trigger.5442' @@ -289,11 +293,14 @@ recovery_end_command = 'rm -f /tmp/pgsql.trigger.5442' archive_command = 'copy %p ...\\archive\\%f' restore_command = 'pg_standby -d -s 5 -t C:\pgsql.trigger.5442 ...\archive %f %p %r 2>>standby.log' + +recovery_end_command = 'del C:\pgsql.trigger.5442' Note that backslashes need to be doubled in the archive_command, but not in the - restore_command. This will: + restore_command or recovery_end_command. + This will: @@ -318,6 +325,11 @@ restore_command = 'pg_standby -d -s 5 -t C:\pgsql.trigger.5442 ...\archive %f %p and perform failover according to its content + + + remove the trigger file when recovery ends + + remove no-longer-needed files from the archive directory @@ -335,7 +347,7 @@ restore_command = 'pg_standby -d -s 5 -t C:\pgsql.trigger.5442 ...\archive %f %p - Using the Since the Windows example uses copy at both ends, either + Since the Windows example uses copy at both ends, either or both servers might be accessing the archive directory across the network. @@ -356,6 +368,11 @@ restore_command = 'pg_standby -d -s 5 -t C:\pgsql.trigger.5442 ...\archive %f %p -k option must be used if archive cleanup is required. This option remains available in 8.3, but its use is deprecated. + + PostgreSQL 8.4 provides the + recovery_end_command option. Without this option + a leftover trigger file can be hazardous. +