Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lFAYE-000065-Bt for pgsql-docs@arkaria.postgresql.org; Thu, 25 Feb 2021 06:55:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lFAYC-0004hY-HZ for pgsql-docs@arkaria.postgresql.org; Thu, 25 Feb 2021 06:55:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lFAYC-0004hR-Bi for pgsql-docs@lists.postgresql.org; Thu, 25 Feb 2021 06:55:04 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lFAY9-0006al-Uj for pgsql-docs@lists.postgresql.org; Thu, 25 Feb 2021 06:55:03 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 179645C0154; Thu, 25 Feb 2021 01:55:00 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 25 Feb 2021 01:55:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=gbHbuiv6h1DWsz224e3i1Qo1HiN QLed62EW7HGoXUO8=; b=NWy8a2fbQNCH5Ku5xeUn0UJOATs1sGDt9AFP5aou/S/ Q2g2uIY8BhgEC+H3xmaUu2Du6NtgR82OIsFwL02/6r49wxoVzBs5NdrLkxF2R2nt qRGeCTzsYyOy9osPddyuAoVxhtxTTvNHNLXbBOW0Z0iO1Ti+2GAa67Y9XOeYU9YK yMlbxRhFDA8JdLwgtl+0ZGqSs7PbmXgOXQumn/OnC0eQEPJ4s5ALulRsOo1JdiTB XVo9oAD+4+o/4dcEhsVGYaxPmjAoZV9mWMzJjmv6gfR9M9vd2cXb2ElENtCFiSFh vZdi44z3by5GSeqWEpS8xF25PJeyoD9MPcrAvDYUO4g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=gbHbui v6h1DWsz224e3i1Qo1HiNQLed62EW7HGoXUO8=; b=h48DEPmlmvIQRz48btBCZd rE2MJhbNzvyn9hWlMrYQLbvl9Ap8CTvCRygnAjcoqA1ooXIlWAIeN2vSI3OPmBdq 3qCA/qX2hB7EXqT1Z4Bc7MAv7b7n49Dv2mx4afHrvMFeupYXvtT+SHkcNXLjLj51 3SnTV3fOFT0kFZxrIfUskXyOpOEq9LutXlSt2swnp43WEAYSDZURKBkPMVYZEFAN RlZh0NRKlJmFirjcFZle1+OtU1lHtHve6V/EwygOjX8i2vIVs5lyJcxv78JCcjVz f98Vm8dcKIVfcu7JQkAC4itV3yEAGBzqOCMCaE63xmJVYlFCFA03fy2lnktbI+2Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrkeekgddutddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpedvgeduuefhtdeuleettdevjeeh heeiveeuieegleetgeeljeelieeuieehgeevhfenucfkphepudduuddruddtvddrudektd drudekheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id BE1E41080057; Thu, 25 Feb 2021 01:54:57 -0500 (EST) Date: Thu, 25 Feb 2021 15:54:54 +0900 From: Michael Paquier To: Fujii Masao Cc: Philipp Gramzow , pgsql-docs@lists.postgresql.org Subject: Re: incoorect restore_command Message-ID: References: <161397938841.15451.13129264141285167267@wrigleys.postgresql.org> <478b5b00-5ab3-a1b5-65f4-19b4409c720b@philphonic.de> <3c8a08bb-3eaa-cdc6-08f9-3298342722c2@oss.nttdata.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="OYUBM7EXLPvnYYDe" Content-Disposition: inline In-Reply-To: <3c8a08bb-3eaa-cdc6-08f9-3298342722c2@oss.nttdata.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --OYUBM7EXLPvnYYDe Content-Type: multipart/mixed; boundary="OH8fGQ54ytqtZZJY" Content-Disposition: inline --OH8fGQ54ytqtZZJY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --OH8fGQ54ytqtZZJY Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="doc-archive-gz-v2.patch" 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' on, and set up an archive_command that performs archiving only when a switch file exists. For example: -archive_command = 'test ! -f /var/lib/pgsql/backup_in_progress || (test ! -f /var/lib/pgsql/archive/%f && cp %p /var/lib/pgsql/archive/%f)' +archive_command = 'test ! -f /var/lib/pgsql/backup_in_progress || (test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f)' This command will perform archiving when /var/lib/pgsql/backup_in_progress 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/ The switch file /var/lib/pgsql/backup_in_progress 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 gzip to compress the archive files: -archive_command = 'gzip < %p > /var/lib/pgsql/archive/%f' +archive_command = 'gzip < %p > /mnt/server/archivedir/%f.gz' You will then need to use gunzip during recovery: -restore_command = 'gunzip < /mnt/server/archivedir/%f > %p' +restore_command = 'gunzip < /mnt/server/archivedir/%f.gz > %p' --OH8fGQ54ytqtZZJY-- --OYUBM7EXLPvnYYDe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmA3Sb4ACgkQnvQgOdby QH1bUA//fCy4TbZq0Ilt4JGEcN3xUDsXCYSWyRmOASCygnmuLV0TpJaLxnjsnJri J1XD5pnhrQzJVx1Y9vY8dA97KAR67ajpxuxqMdNqUHcsA+13g1TH6xBk718KDY6V TqkNaPlsa363VVZLwr+yZgsUjxPcVUBYFZvOXd4FYE5qcRe5W3YRDOXvj1FOHPac mjMwCyqfFnTX3MTiJg722FLwVJr4nFu77KBY2IjqNdLNi2gqu1U7NlsFaqVnVdx6 pbu0XkKd/GlqhMlqVdybxpn8803mpGpsuAQshMWLFX39DTp/mGwTejUbW/LX+r28 wXoY5T8u2nvlRMZPYE5JsHwQZyKoK4BHr/xLPre3hJaR+mmQ8LaKkC7qHmnV7om4 ea/U0U26AzYoNUNv8nneRCjK8NShJQBbxzFK2Q9B4dIUNxxyROqmX7AO4MNmV99K RiVDdmsh3YHzdvAh6HLJzfoMPhIWur5vq/lSKTsEN2nO7Alr1zE9vbDBqYmCiJ70 2ghEKylUCTASe6HOxLF/6+Htz0INqGRSKGXPf+CVq98AFeZdqszESHkOr3UDFDpY KOUOHkqxrlWnNYcAepE/+WhvzNx/78vYH0ljfXImVt6yl9j5FKnfST3d5i1CSeuf YBYLe9mUKeaSaA/x7RgSu8rsK2icQuy41JjDOvWcGTrzN0Kqpgc= =dXci -----END PGP SIGNATURE----- --OYUBM7EXLPvnYYDe--