pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Philipp Gramzow <phil@philphonic.de>
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: incoorect restore_command
Date: Thu, 25 Feb 2021 15:54:54 +0900
Message-ID: <YDdJvgQIiBcF6JgR@paquier.xyz> (raw)
In-Reply-To: <3c8a08bb-3eaa-cdc6-08f9-3298342722c2@oss.nttdata.com>
References: <161397938841.15451.13129264141285167267@wrigleys.postgresql.org>
	<YDXo2tIJmkW6mhkm@paquier.xyz>
	<478b5b00-5ab3-a1b5-65f4-19b4409c720b@philphonic.de>
	<YDYFuW+6Y72vRk9Q@paquier.xyz>
	<3c8a08bb-3eaa-cdc6-08f9-3298342722c2@oss.nttdata.com>

On Wed, Feb 24, 2021 at 08:15:59PM +0900, Fujii Masao wrote:
> But I have one question; why do those commands use different
> archive directories? Isn't it better to use the same one?

storage.sgml uses /var/lib/pgsql/data for the location of the data,
and the archive path is a mix between /mnt/server/archivedir/ and
/var/lib/pgsql/archive/.  However, the former is used for
pg_archivecleanup and in postgresql.conf.sample, so why not just using
/mnt/server/archivedir/ in backup.sgml?  Please see the attached.
--
Michael

Attachments:

doc-archive-gz-v2.patch (text/x-diff, 2.0K) download diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml index 3c8aaed0b6..d8a60f7529 100644 --- a/doc/src/sgml/backup.sgml +++ b/doc/src/sgml/backup.sgml @@ -1484,7 +1484,7 @@ restore_command = 'cp /mnt/server/archivedir/%f %p' <literal>on</literal>, and set up an <varname>archive_command</varname> that performs archiving only when a <emphasis>switch file</emphasis> exists. For example: <programlisting> -archive_command = 'test ! -f /var/lib/pgsql/backup_in_progress || (test ! -f /var/lib/pgsql/archive/%f &amp;&amp; cp %p /var/lib/pgsql/archive/%f)' +archive_command = 'test ! -f /var/lib/pgsql/backup_in_progress || (test ! -f /mnt/server/archivedir/%f &amp;&amp; cp %p /mnt/server/archivedir/%f)' </programlisting> This command will perform archiving when <filename>/var/lib/pgsql/backup_in_progress</filename> exists, and otherwise @@ -1501,7 +1501,7 @@ psql -c "select pg_start_backup('hot_backup');" tar -cf /var/lib/pgsql/backup.tar /var/lib/pgsql/data/ psql -c "select pg_stop_backup();" rm /var/lib/pgsql/backup_in_progress -tar -rf /var/lib/pgsql/backup.tar /var/lib/pgsql/archive/ +tar -rf /var/lib/pgsql/backup.tar /mnt/server/archivedir/ </programlisting> The switch file <filename>/var/lib/pgsql/backup_in_progress</filename> is created first, enabling archiving of completed WAL files to occur. @@ -1520,11 +1520,11 @@ tar -rf /var/lib/pgsql/backup.tar /var/lib/pgsql/archive/ If archive storage size is a concern, you can use <application>gzip</application> to compress the archive files: <programlisting> -archive_command = 'gzip &lt; %p &gt; /var/lib/pgsql/archive/%f' +archive_command = 'gzip &lt; %p &gt; /mnt/server/archivedir/%f.gz' </programlisting> You will then need to use <application>gunzip</application> during recovery: <programlisting> -restore_command = 'gunzip &lt; /mnt/server/archivedir/%f &gt; %p' +restore_command = 'gunzip &lt; /mnt/server/archivedir/%f.gz &gt; %p' </programlisting> </para> </sect3>
signature.asc (application/pgp-signature, 832B) download

view thread (9+ messages)  latest in thread

Message-ID: <YDdJvgQIiBcF6JgR@paquier.xyz>
Permalink:  ../YDdJvgQIiBcF6JgR@paquier.xyz/
Also on:    postgresql.org/message-id/YDdJvgQIiBcF6JgR@paquier.xyz

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: michael@paquier.xyz, masao.fujii@oss.nttdata.com, phil@philphonic.de, pgsql-docs@lists.postgresql.org
  Subject: Re: incoorect restore_command
  In-Reply-To: <YDdJvgQIiBcF6JgR@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox