Re: Archive clean up command in recovery.conf

From: "CONVERS Yann - DREAL Auvergne-Rhône-Alpes/CIDDAE/SIG" <yann(dot)convers(at)developpement-durable(dot)gouv(dot)fr>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Archive clean up command in recovery.conf
Date: 2018-09-24 07:53:34
Message-ID: e04417d9-3eb4-83c7-ceec-7cb162ce4106@developpement-durable.gouv.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
check <b>notes</b> after <br>
<br>
archive cleanup command  from
<a class="moz-txt-link-freetext" href="https://www.postgresql.org/docs/9.1/static/archive-recovery-settings.html">https://www.postgresql.org/docs/9.1/static/archive-recovery-settings.html</a><br>
<br>
i think it's not for you because you have 3 serveurs and two
slaves.. check replication slot instead it's most efficient for your
usage.<br>
<br>
<dl>
<dt><tt class="VARNAME">archive_cleanup_command</tt> (<tt
class="TYPE">string</tt>)</dt>
<dd>
<p>This optional parameter specifies a shell command that will
be executed at every restartpoint. The purpose of <tt
class="VARNAME">archive_cleanup_command</tt> is to provide a
mechanism for cleaning up old archived WAL files that are no
longer needed by the standby server. Any <tt class="LITERAL">%r</tt>
is replaced by the name of the file containing the last valid
restart point. That is the earliest file that must be <span
class="emphasis EMPHASIS c2">kept</span> to allow a restore
to be restartable, and so all files earlier than <tt
class="LITERAL">%r</tt> may be safely removed. This
information can be used to truncate the archive to just the
minimum required to support restart from the current restore.
The <a
href="https://www.postgresql.org/docs/9.1/static/pgarchivecleanup.html">pg_archivecleanup</a>
module is often used in <tt class="VARNAME">archive_cleanup_command</tt>
for single-standby configurations, for example:</p>
<pre class="PROGRAMLISTING">archive_cleanup_command = 'pg_archivecleanup /mnt/server/archivedir %r'
</pre>
<p><b>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. </b><b><tt
class="VARNAME">archive_cleanup_command</tt></b><b> would
typically be used in a warm-standby configuration (see </b><b><a
href="https://www.postgresql.org/docs/9.1/static/warm-standby.html">Section
25.2</a></b><b>). Write </b><b><tt class="LITERAL">%%</tt></b><b>
to embed an actual </b><b><tt class="LITERAL">%</tt></b><b>
character in the command.</b></p>
<p>If the command returns a non-zero exit status then a WARNING
log message will be written.</p>
</dd>
</dl>
<br>
<div class="moz-cite-prefix">Le 23/09/2018 à 14:13, "&gt; Prince
Pathria (par Internet, dépôt
<a class="moz-txt-link-abbreviated" href="mailto:pgsql-admin-owner+m63745-89476(at)lists(dot)postgresql(dot)org">pgsql-admin-owner+m63745-89476(at)lists(dot)postgresql(dot)org</a>)" a écrit :<br>
</div>
<blockquote
cite="mid:CAON0Day9vqmy3HSqB2eskSN-uxUuQpW+eCvdH1rRt+YO=39sfg(at)mail(dot)gmail(dot)com"
type="cite">
<div dir="ltr">
<div dir="ltr">Hi,
<div><br>
</div>
<div>I have a doubt, assume that I have 3 psql10 nodes (n1,
n2, n3) and n1 is master ,n2+n3 are standbys. In n1 archive
mode is on, and wal_logs are going to volume which is shared
with n2 and n3. If   archive_cleanup_command =
'pg_archivecleanup /path/to/nfs %r' is enabled on both n2
and n3.</div>
<div><br>
</div>
<div>Can a situation might arise that a wal segment required
by n2 is already cleaned up by n3?</div>
<div><br>
</div>
<div>If yes, then how to mitigate it?</div>
<div><br>
</div>
<div>Thanks!</div>
<div>
<div>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div><font face="Arial" color="#888888"><span style="font-size:11.3333px;white-space:pre-wrap">
</span></font></div>
<div><font face="Arial" color="#888888"><span style="font-size:11.3333px;white-space:pre-wrap">Prince Pathria
Systems Architect
Evive
+91 9478670472
<a moz-do-not-send="true" href="http://goevive.com" target="_blank">goevive.com</a></span></font><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 4.8 KB

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Shreeyansh Dba 2018-09-24 08:10:28 Re: Configuration changes with multiple standby nodes
Previous Message CONVERS Yann - DREAL Auvergne-Rhône-Alpes/CIDDAE/SIG 2018-09-24 07:47:11 Tr: Re: WAL segments held for replcation