Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1icsRl-00037z-Eq for pgsql-general@arkaria.postgresql.org; Thu, 05 Dec 2019 14:49:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1icsRj-000377-UR for pgsql-general@arkaria.postgresql.org; Thu, 05 Dec 2019 14:49:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1icsRj-00036y-GL for pgsql-general@lists.postgresql.org; Thu, 05 Dec 2019 14:49:35 +0000 Received: from mx1.stadt-zuerich.ch ([194.56.33.10]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1icsRf-0004NX-RG for pgsql-general@lists.postgresql.org; Thu, 05 Dec 2019 14:49:34 +0000 X-IronPort-AV: E=Sophos;i="5.69,281,1571695200"; d="scan'208";a="114114112" Received: from unknown (HELO SZHM27373.global.szh.loc) ([10.7.49.60]) by mx1.prm.szh.zone with ESMTP/TLS/AES256-GCM-SHA384; 05 Dec 2019 15:49:29 +0100 Received: from SZHM27370.global.szh.loc (10.7.50.50) by SZHM27373.global.szh.loc (10.7.49.63) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 5 Dec 2019 15:49:28 +0100 Received: from SZHM27370.global.szh.loc ([fe80::25ce:879f:5795:3325]) by SZHM27370.global.szh.loc ([fe80::25ce:879f:5795:3325%10]) with mapi id 15.01.1713.004; Thu, 5 Dec 2019 15:49:28 +0100 From: "Zwettler Markus (OIZ)" To: Stephen Frost CC: "pgsql-general@lists.postgresql.org" Subject: AW: secure deletion of archived logs Thread-Topic: secure deletion of archived logs Thread-Index: AdWqjHC6j04/Bfo9RZmTv+0RD1pGLwAEkD0AADbPqWA= Date: Thu, 5 Dec 2019 14:49:28 +0000 Message-ID: <727207b3df3a407983a066c22dc1cd84@zuerich.ch> References: <06d9534503de4b14a7f35a1d08dcc4c6@zuerich.ch> <20191204133104.GG6962@tamriel.snowman.net> In-Reply-To: <20191204133104.GG6962@tamriel.snowman.net> Accept-Language: de-CH, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.7.48.250] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > Greetings, >=20 > * Zwettler Markus (OIZ) (Markus.Zwettler@zuerich.ch) wrote: > > with Oracle we use "backup archivelog all delete all input". > > this is a kind of atomic transaction. > > everything backuped for sure is deleted. > > > > with Postgres we archive to a local host directory >=20 > ... how? Do you actually sync the files after you copy them with an fsyn= c to be > sure that they're durably stored there? If not, then there's a pretty go= od chance > that you'll lose some WAL if a crash happens because if your archive comm= and > returns successful, PG will removed its copy of the WAL file. >=20 > Hint: using 'cp' as an archive command is a very bad idea. >=20 > > we do a Networker backup of this directory afterwards and delete the > > archived logs but this is not an atomic transaction so there is a > > small risk that something gets deleted which is not backuped >=20 > That would definitely be quite bad, particularly if a WAL file that was n= eeded for a > backup to be consistent was removed or missed, as that backup would no lo= nger > be valid then. >=20 > > how to you prevent this? >=20 > I would strongly recommend that you use a tool that's actually built for = the purpose > of backing up PG systems, like pgbackrest or similar. > Writing your own custom code for managing WAL archives and backup sets is > likely to result in issues. >=20 > > Is there any backup tool which can do backups analogous Oracle? >=20 > There's quite a few different tools available for backing up PG systems, = with > various features and performance- from simple things like pg_basebackup (= which > you can set up to include all the WAL for the backup to be consistent, th= ough that > doesn't do anything to help you with managing WAL for PITR), to much more > sophisticated tools like pgbackrest, wal-g, and others that help with man= aging > WAL and dealing with expiring out backups and such. The biggest thing is= - don't > try to roll your own. >=20 > Thanks, >=20 > Stephen We use "rsync" on XFS with "wsync" mount mode. I think this should do the j= ob? The tools mentioned will all do backup to disk. We are required to do backup to tape. Markus