Re: Backup "Best Practices"

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Backup "Best Practices"
Date: 2016-11-29 19:18:07
Message-ID: CAMkU=1zNWZb_pWuVjsWpt+toixMi1RXhQy9FGaLkET8GPhVS6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Nov 28, 2016 at 11:20 PM, Thomas Kellerer <spam_eater(at)gmx(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2016-11-29 21:31:49 Re: Exclude pg_largeobject form pg_dump
Previous Message Israel Brewster 2016-11-29 18:33:01 Re: Backup "Best Practices"