Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
70858917
Commit
70858917
authored
Oct 14, 2010
by
Simon Riggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to docs about pg_archive_cleanup and use of archives
Brendan Jurd
parent
3bbcc5c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
42 deletions
+54
-42
doc/src/sgml/high-availability.sgml
doc/src/sgml/high-availability.sgml
+13
-13
doc/src/sgml/pgarchivecleanup.sgml
doc/src/sgml/pgarchivecleanup.sgml
+17
-15
doc/src/sgml/recovery-config.sgml
doc/src/sgml/recovery-config.sgml
+24
-14
No files found.
doc/src/sgml/high-availability.sgml
View file @
70858917
...
@@ -680,11 +680,6 @@ protocol to make nodes agree on a serializable transactional order.
...
@@ -680,11 +680,6 @@ protocol to make nodes agree on a serializable transactional order.
<varname>primary_conninfo</> as well.
<varname>primary_conninfo</> as well.
</para>
</para>
<para>
You can use <varname>archive_cleanup_command</> to prune the archive of
files no longer needed by the standby.
</para>
<para>
<para>
If you're setting up the standby server for high availability purposes,
If you're setting up the standby server for high availability purposes,
set up WAL archiving, connections and authentication like the primary
set up WAL archiving, connections and authentication like the primary
...
@@ -696,6 +691,18 @@ protocol to make nodes agree on a serializable transactional order.
...
@@ -696,6 +691,18 @@ protocol to make nodes agree on a serializable transactional order.
is not required.
is not required.
</para>
</para>
<para>
If you're using a WAL archive, its size can be minimized using the <xref
linkend="archive-cleanup-command"> parameter to remove files that are no
longer required by the standby server.
The <application>pg_archivecleanup</> utility is designed specifically to
be used with <varname>archive_cleanup_command</> in typical single-standby
configurations, see <xref linkend="pgarchivecleanup">.
Note however, that if you're using the archive for backup purposes, you
need to retain files needed to recover from at least the latest base
backup, even if they're no longer needed by the standby.
</para>
<para>
<para>
A simple example of a <filename>recovery.conf</> is:
A simple example of a <filename>recovery.conf</> is:
<programlisting>
<programlisting>
...
@@ -703,6 +710,7 @@ standby_mode = 'on'
...
@@ -703,6 +710,7 @@ standby_mode = 'on'
primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass'
primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass'
restore_command = 'cp /path/to/archive/%f %p'
restore_command = 'cp /path/to/archive/%f %p'
trigger_file = '/path/to/trigger_file'
trigger_file = '/path/to/trigger_file'
archive_cleanup_command = 'pg_archivecleanup /path/to/archive %r'
</programlisting>
</programlisting>
</para>
</para>
...
@@ -712,14 +720,6 @@ trigger_file = '/path/to/trigger_file'
...
@@ -712,14 +720,6 @@ trigger_file = '/path/to/trigger_file'
the primary to allow them to be connected simultaneously.
the primary to allow them to be connected simultaneously.
</para>
</para>
<para>
If you're using a WAL archive, its size can be minimized using
the <varname>archive_cleanup_command</> option to remove files that are
no longer required by the standby server. Note however, that if you're
using the archive for backup purposes, you need to retain files needed
to recover from at least the latest base backup, even if they're no
longer needed by the standby.
</para>
</sect2>
</sect2>
<sect2 id="streaming-replication">
<sect2 id="streaming-replication">
...
...
doc/src/sgml/pgarchivecleanup.sgml
View file @
70858917
...
@@ -8,10 +8,11 @@
...
@@ -8,10 +8,11 @@
</indexterm>
</indexterm>
<para>
<para>
<application>pg_archivecleanup</> is designed to cleanup an archive when used
<application>pg_archivecleanup</> is designed to be used as an
as an <literal>archive_cleanup_command</literal> when running with
<literal>archive_cleanup_command</literal> to clean up WAL file archives when
<literal>standby_mode = on</literal>. <application>pg_archivecleanup</> can
running as a standby server (see <xref linkend="warm-standby">).
also be used as a standalone program to clean WAL file archives.
<application>pg_archivecleanup</> can also be used as a standalone program to
clean WAL file archives.
</para>
</para>
<para>
<para>
...
@@ -39,20 +40,21 @@
...
@@ -39,20 +40,21 @@
server to use <application>pg_archivecleanup</>, put this into its
server to use <application>pg_archivecleanup</>, put this into its
<filename>recovery.conf</filename> configuration file:
<filename>recovery.conf</filename> configuration file:
<programlisting>
<programlisting>
archive_cleanup_command = 'pg_archivecleanup <replaceable>archive
Dir
</> %r'
archive_cleanup_command = 'pg_archivecleanup <replaceable>archive
location
</> %r'
</programlisting>
</programlisting>
where <replaceable>archive
Dir
</> is the directory from which WAL segment
where <replaceable>archive
location
</> is the directory from which WAL segment
files should be re
stor
ed.
files should be re
mov
ed.
</para>
</para>
<para>
<para>
When used within <literal>archive_cleanup_command</literal>,
When used within <xref linkend="archive-cleanup-command">, all WAL files
all WAL files logically preceding the value of the <literal>%r</>
logically preceding the value of the <literal>%r</> argument will be removed
will be removed <replaceable>archivelocation</>. This minimizes
from <replaceable>archivelocation</>. This minimizes the number of files
the number of files that need to be retained, while preserving
that need to be retained, while preserving crash-restart capability. Use of
crash-restart capability. Use of this parameter is appropriate if the
this parameter is appropriate if the <replaceable>archivelocation</> is a
<replaceable>archivelocation</> is a transient staging area for this
transient staging area for this particular standby server, but
particular standby server, but <emphasis>not</> when the
<emphasis>not</> when the <replaceable>archivelocation</> is intended as a
<replaceable>archivelocation</> is intended as a long-term WAL archive area.
long-term WAL archive area, or when multiple standby servers are recovering
from the same archive location.
</para>
</para>
<para>
<para>
The full syntax of <application>pg_archivecleanup</>'s command line is
The full syntax of <application>pg_archivecleanup</>'s command line is
...
...
doc/src/sgml/recovery-config.sgml
View file @
70858917
...
@@ -80,20 +80,30 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
...
@@ -80,20 +80,30 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
</indexterm>
</indexterm>
<listitem>
<listitem>
<para>
<para>
This parameter specifies a shell command that will be executed at
This optional parameter specifies a shell command that will be executed
every restartpoint. This parameter is optional. The purpose of the
at every restartpoint. The purpose of
<varname>archive_cleanup_command</> is to provide a mechanism for cleaning
<varname>archive_cleanup_command</> is to provide a mechanism for
up old archived WAL files that are no longer needed by the standby
cleaning up old archived WAL files that are no longer needed by the
server.
standby server.
Any <literal>%r</> is replaced by the name of the file
Any <literal>%r</> is replaced by the name of the file containing the
containing the last valid restart point. That is the earliest file that
last valid restart point.
must be kept to allow a restore to be restartable, so this information
That is the earliest file that must be <emphasis>kept</> to allow a
can be used to truncate the archive to just the minimum required to
restore to be restartable, and so all files earlier than <literal>%r</>
support restart from the current restore. <literal>%r</> would
may be safely removed.
typically be used in a warm-standby configuration
This information can be used to truncate the archive to just the
(see <xref linkend="warm-standby">).
minimum required to support restart from the current restore.
Write <literal>%%</> to embed an actual <literal>%</> character
The <application>pg_archivecleanup</> utility provided in
in the command.
<literal>contrib</> (see <xref linkend="pgarchivecleanup">) serves as a
convenient target for <varname>archive_cleanup_command</> in typical
single-standby configurations, for example:
<programlisting> archive_cleanup_command = 'pg_archivecleanup /mnt/server/archivedir %r' </programlisting>
Note however that if multiple standby servers are restoring from the
same archive directory, you will need to ensure that you do not delete
WAL files until they are no longer needed by any of the servers.
<varname>archive_cleanup_command</> would typically be used in a
warm-standby configuration (see <xref linkend="warm-standby">).
Write <literal>%%</> to embed an actual <literal>%</> character in the
command.
</para>
</para>
<para>
<para>
If the command returns a non-zero exit status then a WARNING log
If the command returns a non-zero exit status then a WARNING log
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment