Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3229db2

Browse files
committed
Move documentation of all recovery.conf option to a new chapter.
They used to be scattered between the "backup and restore" and "streaming replication" chapters.
1 parent 9738beb commit 3229db2

File tree

5 files changed

+247
-230
lines changed

5 files changed

+247
-230
lines changed

doc/src/sgml/backup.sgml

Lines changed: 2 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/backup.sgml,v 2.142 2010/02/19 00:15:25 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/backup.sgml,v 2.143 2010/02/22 11:47:30 heikki Exp $ -->
22

33
<chapter id="backup">
44
<title>Backup and Restore</title>
@@ -955,7 +955,7 @@ SELECT pg_stop_backup();
955955
<listitem>
956956
<para>
957957
Create a recovery command file <filename>recovery.conf</> in the cluster
958-
data directory (see <xref linkend="recovery-config-settings">). You might
958+
data directory (see <xref linkend="recovery-config">). You might
959959
also want to temporarily modify <filename>pg_hba.conf</> to prevent
960960
ordinary users from connecting until you are sure the recovery was successful.
961961
</para>
@@ -1076,162 +1076,6 @@ restore_command = 'cp /mnt/server/archivedir/%f %p'
10761076
WAL data need not be scanned again.
10771077
</para>
10781078

1079-
1080-
<sect3 id="recovery-config-settings" xreflabel="Recovery Settings">
1081-
<title>Recovery Settings</title>
1082-
1083-
<para>
1084-
These settings can only be made in the <filename>recovery.conf</>
1085-
file, and apply only for the duration of the recovery. (A sample file,
1086-
<filename>share/recovery.conf.sample</>, exists in the installation's
1087-
<filename>share/</> directory.) They must be
1088-
reset for any subsequent recovery you wish to perform. They cannot be
1089-
changed once recovery has begun.
1090-
The parameters for streaming replication are described in <xref
1091-
linkend="replication-config-settings">.
1092-
</para>
1093-
1094-
<variablelist>
1095-
1096-
<varlistentry id="restore-command" xreflabel="restore_command">
1097-
<term><varname>restore_command</varname> (<type>string</type>)</term>
1098-
<listitem>
1099-
<para>
1100-
The shell command to execute to retrieve an archived segment of
1101-
the WAL file series. This parameter is required for archive recovery,
1102-
but optional for streaming replication.
1103-
Any <literal>%f</> in the string is
1104-
replaced by the name of the file to retrieve from the archive,
1105-
and any <literal>%p</> is replaced by the copy destination path name
1106-
on the server.
1107-
(The path name is relative to the current working directory,
1108-
i.e., the cluster's data directory.)
1109-
Any <literal>%r</> is replaced by the name of the file containing the
1110-
last valid restart point. That is the earliest file that must be kept
1111-
to allow a restore to be restartable, so this information can be used
1112-
to truncate the archive to just the minimum required to support
1113-
restarting from the current restore. <literal>%r</> is typically only
1114-
used by warm-standby configurations
1115-
(see <xref linkend="warm-standby">).
1116-
Write <literal>%%</> to embed an actual <literal>%</> character.
1117-
</para>
1118-
1119-
<para>
1120-
It is important for the command to return a zero exit status
1121-
only if it succeeds. The command <emphasis>will</> be asked for file
1122-
names that are not present in the archive; it must return nonzero
1123-
when so asked. Examples:
1124-
<programlisting>
1125-
restore_command = 'cp /mnt/server/archivedir/%f "%p"'
1126-
restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
1127-
</programlisting>
1128-
</para>
1129-
</listitem>
1130-
</varlistentry>
1131-
1132-
<varlistentry id="recovery-end-command" xreflabel="recovery_end_command">
1133-
<term><varname>recovery_end_command</varname> (<type>string</type>)</term>
1134-
<listitem>
1135-
<para>
1136-
This parameter specifies a shell command that will be executed once only
1137-
at the end of recovery. This parameter is optional. The purpose of the
1138-
<varname>recovery_end_command</> is to provide a mechanism for cleanup
1139-
following replication or recovery.
1140-
Any <literal>%r</> is replaced by the name of the file
1141-
containing the last valid restart point. That is the earliest file that
1142-
must be kept to allow a restore to be restartable, so this information
1143-
can be used to truncate the archive to just the minimum required to
1144-
support restart from the current restore. <literal>%r</> would
1145-
typically be used in a warm-standby configuration
1146-
(see <xref linkend="warm-standby">).
1147-
Write <literal>%%</> to embed an actual <literal>%</> character
1148-
in the command.
1149-
</para>
1150-
<para>
1151-
If the command returns a non-zero exit status then a WARNING log
1152-
message will be written and the database will proceed to start up
1153-
anyway. An exception is that if the command was terminated by a
1154-
signal, the database will not proceed with startup.
1155-
</para>
1156-
</listitem>
1157-
</varlistentry>
1158-
1159-
<varlistentry id="recovery-target-time" xreflabel="recovery_target_time">
1160-
<term><varname>recovery_target_time</varname>
1161-
(<type>timestamp</type>)
1162-
</term>
1163-
<listitem>
1164-
<para>
1165-
This parameter specifies the time stamp up to which recovery
1166-
will proceed.
1167-
At most one of <varname>recovery_target_time</> and
1168-
<xref linkend="recovery-target-xid"> can be specified.
1169-
The default is to recover to the end of the WAL log.
1170-
The precise stopping point is also influenced by
1171-
<xref linkend="recovery-target-inclusive">.
1172-
</para>
1173-
</listitem>
1174-
</varlistentry>
1175-
1176-
<varlistentry id="recovery-target-xid" xreflabel="recovery_target_xid">
1177-
<term><varname>recovery_target_xid</varname> (<type>string</type>)</term>
1178-
<listitem>
1179-
<para>
1180-
This parameter specifies the transaction ID up to which recovery
1181-
will proceed. Keep in mind
1182-
that while transaction IDs are assigned sequentially at transaction
1183-
start, transactions can complete in a different numeric order.
1184-
The transactions that will be recovered are those that committed
1185-
before (and optionally including) the specified one.
1186-
At most one of <varname>recovery_target_xid</> and
1187-
<xref linkend="recovery-target-time"> can be specified.
1188-
The default is to recover to the end of the WAL log.
1189-
The precise stopping point is also influenced by
1190-
<xref linkend="recovery-target-inclusive">.
1191-
</para>
1192-
</listitem>
1193-
</varlistentry>
1194-
1195-
<varlistentry id="recovery-target-inclusive"
1196-
xreflabel="recovery_target_inclusive">
1197-
<term><varname>recovery_target_inclusive</varname>
1198-
(<type>boolean</type>)
1199-
</term>
1200-
<listitem>
1201-
<para>
1202-
Specifies whether we stop just after the specified recovery target
1203-
(<literal>true</literal>), or just before the recovery target
1204-
(<literal>false</literal>).
1205-
Applies to both <xref linkend="recovery-target-time">
1206-
and <xref linkend="recovery-target-xid">, whichever one is
1207-
specified for this recovery. This indicates whether transactions
1208-
having exactly the target commit time or ID, respectively, will
1209-
be included in the recovery. Default is <literal>true</>.
1210-
</para>
1211-
</listitem>
1212-
</varlistentry>
1213-
1214-
<varlistentry id="recovery-target-timeline"
1215-
xreflabel="recovery_target_timeline">
1216-
<term><varname>recovery_target_timeline</varname>
1217-
(<type>string</type>)
1218-
</term>
1219-
<listitem>
1220-
<para>
1221-
Specifies recovering into a particular timeline. The default is
1222-
to recover along the same timeline that was current when the
1223-
base backup was taken. You only need to set this parameter
1224-
in complex re-recovery situations, where you need to return to
1225-
a state that itself was reached after a point-in-time recovery.
1226-
See <xref linkend="backup-timelines"> for discussion.
1227-
</para>
1228-
</listitem>
1229-
</varlistentry>
1230-
1231-
</variablelist>
1232-
1233-
</sect3>
1234-
12351079
</sect2>
12361080

12371081
<sect2 id="backup-timelines">

doc/src/sgml/filelist.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/filelist.sgml,v 1.66 2010/02/17 04:19:37 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/filelist.sgml,v 1.67 2010/02/22 11:47:30 heikki Exp $ -->
22

33
<!entity history SYSTEM "history.sgml">
44
<!entity info SYSTEM "info.sgml">
@@ -42,6 +42,7 @@
4242
<!entity manage-ag SYSTEM "manage-ag.sgml">
4343
<!entity monitoring SYSTEM "monitoring.sgml">
4444
<!entity regress SYSTEM "regress.sgml">
45+
<!entity recovery-config SYSTEM "recovery-config.sgml">
4546
<!entity runtime SYSTEM "runtime.sgml">
4647
<!entity config SYSTEM "config.sgml">
4748
<!entity user-manag SYSTEM "user-manag.sgml">

doc/src/sgml/high-availability.sgml

Lines changed: 8 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/high-availability.sgml,v 1.48 2010/02/20 10:07:27 sriggs Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/high-availability.sgml,v 1.49 2010/02/22 11:47:30 heikki Exp $ -->
22

33
<chapter id="high-availability">
44
<title>High Availability, Load Balancing, and Replication</title>
@@ -853,77 +853,15 @@ if (!triggered)
853853
<listitem>
854854
<para>
855855
Create a recovery command file <filename>recovery.conf</> in the data
856-
directory on the standby server.
856+
directory on the standby server. Set <varname>restore_command</varname>
857+
as you would in normal recovery from a continuous archiving backup
858+
(see <xref linkend="backup-pitr-recovery">). <literal>pg_standby</> or
859+
similar tools that wait for the next WAL file to arrive cannot be used
860+
with streaming replication, as the server handles retries and waiting
861+
itself. Enable <varname>standby_mode</varname>. Set
862+
<varname>primary_conninfo</varname> to point to the primary server.
857863
</para>
858864

859-
<variablelist id="replication-config-settings" xreflabel="Replication Settings">
860-
<varlistentry id="standby-mode" xreflabel="standby_mode">
861-
<term><varname>standby_mode</varname> (<type>boolean</type>)</term>
862-
<listitem>
863-
<para>
864-
Specifies whether to start the <productname>PostgreSQL</> server as
865-
a standby. If this parameter is <literal>on</>, the server will
866-
not end recovery when the end of archived WAL is reached, but
867-
will keep trying to continue recovery using <varname>restore_command</>
868-
and by connecting to the primary server as specified by the
869-
<varname>primary_conninfo</> setting.
870-
</para>
871-
</listitem>
872-
</varlistentry>
873-
<varlistentry>
874-
<term><varname>restore_command</varname> (<type>string</type>)</term>
875-
<term><varname>restore_end_command</varname> (<type>string</type>)</term>
876-
<listitem>
877-
<para>
878-
With <varname>standby_mode</> enabled, <varname>restore_command</>
879-
(and <varname>restore_end_command</>) should be set to a
880-
simple command or script like in PITR. <literal>pg_standby</> or similar tools
881-
that wait for the next WAL file to arrive cannot be used with
882-
streaming replication, as the server handles retries and waiting
883-
itself. Set <varname>restore_command</> as you would if you were
884-
recovering using a Continuous archiving backup (see <xref linkend="backup-pitr-recovery">).
885-
</para>
886-
</listitem>
887-
</varlistentry>
888-
<varlistentry id="primary-conninfo" xreflabel="primary_conninfo">
889-
<term><varname>primary_conninfo</varname> (<type>string</type>)</term>
890-
<listitem>
891-
<para>
892-
Specifies a connection string to be used for the standby server
893-
to connect with the primary. This string is in the same format as
894-
described in <xref linkend="libpq-connect">. If any option is
895-
unspecified in this string, then the corresponding environment
896-
variable (see <xref linkend="libpq-envars">) is checked. If the
897-
environment variable is not set either, then
898-
defaults are used.
899-
</para>
900-
<para>
901-
The built-in replication requires that a host name (or host address)
902-
or port number which the primary server listens on be
903-
specified in this string. Also ensure that a role with
904-
the <literal>SUPERUSER</> and <literal>LOGIN</> privileges on the
905-
primary is set (see
906-
<xref linkend="streaming-replication-authentication">). Note that
907-
the password needs to be set if the primary demands password
908-
authentication.
909-
</para>
910-
<para>
911-
This setting has no effect if <varname>standby_mode</> is <literal>off</>.
912-
</para>
913-
</listitem>
914-
</varlistentry>
915-
<varlistentry id="trigger-file" xreflabel="trigger_file">
916-
<term><varname>trigger_file</varname> (<type>string</type>)</term>
917-
<listitem>
918-
<para>
919-
Specifies a trigger file whose presence ends recovery in the
920-
standby. If no trigger file is specified, the standby never exits
921-
recovery.
922-
This setting has no effect if <varname>standby_mode</> is <literal>off</>.
923-
</para>
924-
</listitem>
925-
</varlistentry>
926-
</variablelist>
927865
</listitem>
928866
<listitem>
929867
<para>

doc/src/sgml/postgres.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/postgres.sgml,v 1.90 2009/08/04 22:04:37 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/postgres.sgml,v 1.91 2010/02/22 11:47:30 heikki Exp $ -->
22

33
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.2//EN" [
44

@@ -155,6 +155,7 @@
155155
&maintenance;
156156
&backup;
157157
&high-availability;
158+
&recovery-config;
158159
&monitoring;
159160
&diskusage;
160161
&wal;

0 commit comments

Comments
 (0)