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 1joWK2-0004Ez-T5 for pgsql-general@arkaria.postgresql.org; Thu, 25 Jun 2020 18:10:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1joWK1-0002W1-Qw for pgsql-general@arkaria.postgresql.org; Thu, 25 Jun 2020 18:10:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1joWK1-0002Vl-J5 for pgsql-general@lists.postgresql.org; Thu, 25 Jun 2020 18:10:01 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1joWJz-0005Yy-8F for pgsql-general@postgresql.org; Thu, 25 Jun 2020 18:10:01 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 81CDF5F79F; Thu, 25 Jun 2020 14:09:57 -0400 (EDT) Date: Thu, 25 Jun 2020 14:09:57 -0400 From: Stephen Frost To: Sri Linux Cc: "David G. Johnston" , "pgsql-general@postgresql.org" Subject: Re: Need help with PITR for PostgreSQL 9.4.5 Message-ID: <20200625180957.GU3125@tamriel.snowman.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="doUn1Hmx68n+7ij2" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --doUn1Hmx68n+7ij2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Sri Linux (srilinux09@gmail.com) wrote: > Please find the method used. Please recommend me if I have done > something wrong... Yes, you are using 'cp' which is *not* recommended for an archive command. > Performing a hot backup using pg_basebackup: > Create a new folder as the postgres user > pg_basebackup --xlog --format=3Dt -D /server01/pgbackup/`date %Y%m%d` Note that your pg_basebackup is going to be copying WAL also, in addition to the archive_command you've configured. > Restoring from Backup: > Extract the contents of base.tar from the backed up folder on top of the = PostgreSQL installation folder: > tar -xf base.tar -C /var/lib/pgsql/9.4/data (RedHat/CentOS) > Assuming that there is a single database tar file (named with a number) i= n the backup, extract the contents of this folder to the /server01 folder: > tar -xf .tar -C /server01 > Copy any unarchived WAL log files saved from the first step back into the= pg_xlog folder appropriate for the OS Not sure what "first step" means here, but you are configuring PostgreSQL with a recovery.conf later with a restore command to fetch the WAL it needs =66rom your archive, so you shouldn't be needing to copy files from one pg_xlog to another (which is just generally a bad idea..). Further, the error you're getting, as mentioned, is actually that you've somehow ended up with WAL for some other cluster in your archive and when this instance tries to restore it, it complains (quite understandably). A sensible tool would prevent this from being able to happen by checking that the WAL that's being archived to a given location matches the database that the WAL is for. As mentioned, you should really be considering using a purpose-built tool which manages this for you, such as pgbackrest, which has such checks and provides you with backup/restore commands. Thanks, Stephen --doUn1Hmx68n+7ij2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJe9Oh1AAoJEO1sijiDR2RVs08P/RLhPDd6flYrxjW5dT5c9UlM zeCT/e4P3Rz/mPPq1NYBnK4dM3Las2RzPuu1QrhKxgXHmzBqEzspgk2NEL/37dgp ZXnUCFVBvfEChT+eS2SHKvl5CbJW5sVzXCsxILPBnhzKN6zdGdF+j/7CZnKDXA1M Uva+ZQQUauNKP0lMSJZaAcwrfg7XQY34gHc/MJElOsFZ5MLr1vmGLSu4Cbwm6n0/ GKs67fnEtw+XgtmWl0/otrvV5YOvYDtUClt4IwhEbKzclwClsnd+yqB2nqJPxPN7 ic/78sWtbjs4uL9QyLIFHf1bwYEc8MqQyFps6iKwcU0ZMDDro93I2iKzfizZpAHR i2BU0JjgtuuU9LmmpUx7kZFjmuIMHw1GP7KwAodv1bLoLwpZe6aKDQv0Xu7pHe5D hSJcAk0AUTJf4jucNNrOw9zlR466i1YOnJ3GOz8OIDBH8ihywNyQMnLV9I0ZChuc Tc8QS2kCLR5kjHjb+dQGDQP+NlS1dVyovMaXOPesnnIvEwL7P5SMlzKQgqHuL0pj bbRZRMUfjEFTZzXrkeFVgryTpunJYJKjOyicKLYph4QALgYPpZglrLUKhOHNaETl PM6l5iy+Hoa8oW86QSMTw6Fu6aIFvrZfAcQfw7x/yTkPBl4F3N8s5dKjRETw9aIX Pj26xXCWu12GifG1ig/c =025G -----END PGP SIGNATURE----- --doUn1Hmx68n+7ij2--