Re: pg_basebackup and pg_receivewal timing, missing WAL files

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Re: pg_basebackup and pg_receivewal timing, missing WAL files
Дата
Msg-id 20220609212409.GR9030@tamriel.snowman.net
обсуждение исходный текст
Ответ на Re: pg_basebackup and pg_receivewal timing, missing WAL files  (Tim <timfosho@gmail.com>)
Ответы Re: pg_basebackup and pg_receivewal timing, missing WAL files  (David Steele <david@pgmasters.net>)
Список pgsql-admin
Greetings,

* Tim (timfosho@gmail.com) wrote:
> We currently use pgbackrest as our primary backup tool actually, and it
> works great! The issue I ran into with trying to set it up that way with
> pgbackrest, is when configuring the second repo, pgbackrest will have to
> archive all WAL files to it, going back to the oldest backup. And we have

Eh?  Why is that?  I think there's some confusion here regarding how
pgbackrest multi-repo works.  We won't archive back to the 'oldest
backup' when you add a second repo, we'll just archive *new* WAL to it
after it's been configured.

> this (admittedly arbitrary) legal policy requiring a single instance of a 6
> month old backup for auditing purposes. So pgbackrest has to keep WALs that
> far back, the main repo only needs 4 weeks of WALs for PITR, its a bit
> overkill archiving WALs twice and also storing them an extra 5 months. So I
> opted to write a custom backup script.

You just need to handle the modification of the pgbackrest config to
add/remove the second repo (and run the backup to the second repo when
it's enabled) when you want a new backup of it.

> Though I was not aware of the `--archive-copy` option, I wonder if I can
> just turn that option on for the main repo, and then extract the particular
> backup I need to another location. We use Azure Blobs for backups.

Probably this would also work, yes.

>  Unfortunately `-Xs` cannot be used with pg_basebackup in TAR format, I'm
> using the AzCopy utility, by piping pg_basebackup into it, to stream the
> basebackup directly into Azure Blob storage, without storing it anywhere
> first (Which pgbackrest does natively as well!). So there is no other way
> without using the TAR format option.

... yikes, that sounds horribly rickety.

> Nevertheless, it seems like I need the contents of the pg_wal directory at
> the start of pg_basebackup, since pg_receivewal only streams WAL generated
> after it starts, the restored DB is missing all the files contained
> within, I've adjusted my script to copy them as well and testing currently.

I have to say that I strongly recommend NOT trying to go down this
direction, as it seems terribly risky, not to mention that the WAL files
in pg_wal are still being written to...

Thanks,

Stephen

Вложения

В списке pgsql-admin по дате отправления:

Предыдущее
От: Tim
Дата:
Сообщение: Re: pg_basebackup and pg_receivewal timing, missing WAL files
Следующее
От: David Steele
Дата:
Сообщение: Re: pg_basebackup and pg_receivewal timing, missing WAL files