Re: Backup "Best Practices" - Mailing list pgsql-general

From Jeff Janes
Subject Re: Backup "Best Practices"
Date
Msg-id CAMkU=1zNWZb_pWuVjsWpt+toixMi1RXhQy9FGaLkET8GPhVS6w@mail.gmail.com
Whole thread Raw
In response to Re: Backup "Best Practices"  (Thomas Kellerer <spam_eater@gmx.net>)
List pgsql-general
On Mon, Nov 28, 2016 at 11:20 PM, Thomas Kellerer <spam_eater@gmx.net> wrote:
Israel Brewster schrieb am 28.11.2016 um 23:50:

pg_archivecleanup -n /mnt/server/archiverdir 000000010000000000000010.00000020.backup

Ok, but where does that "000000010000000000000010.00000020.backup"
come from? I mean, I can tell it's a WAL segment file name (plus a
backup label), but I don't have anything like that in my WAL
archives, even though I've run pg_basebackup a couple of times. Do I
have to call something to create that file? Some flag to
pg_basebackup? At the moment I am running pg_basebackup such that it
generates gziped tar files, if that makes a difference.

The .backup file will be inside the tar file if I'm not mistaken

I don't think it will be, but there will be a backup_label file in there, which contains much of the same contents as the .backup file does.  But in this case, the contents of the file are not important, only the name is.  pg_archivecleanup doesn't attempt to open the file-name given as the second argument, it just looks at the name itself.  So you could pull backup_label out of the tar file, parse the contents and use them to construct the command to give to pg_archivecleanup.

I think it would really be nice if pg_basebackup -D backup_dir -Ft would create the backup_label file not only in the tarball, but also (as the final step) create it as a loosie file in the backup_dir.

Cheers,

Jeff



pgsql-general by date:

Previous
From: Israel Brewster
Date:
Subject: Re: Backup "Best Practices"
Next
From: "Sinclair, Ian D (Ian)"
Date:
Subject: How to migrate from PGSQL 9.3 to 9.6