pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Steele <david@pgmasters.net>
To: Benoit Lobréau <benoit.lobreau@gmail.com>
To: yuri.kanivetsky@gmail.com
Cc: ptim007@yahoo.com
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Setting up continuous archiving
Date: Mon, 15 Oct 2018 18:56:41 +0100
Message-ID: <9a3bf365-5dbc-159a-e7fd-e091c0535f0a@pgmasters.net> (raw)
In-Reply-To: <CAPE8EZ4hVaYJeRGz58XJz2X2TF=y7X1bL9dSUQLJBn1wdeScFg@mail.gmail.com>
References: <CAMhVC3ZYGS-tJ1LHBmYAYey+Jz8WJ5uMYVaeDLW=D-iSkf3CEg@mail.gmail.com>
	<307588119.3233604.1537982384823@mail.yahoo.com>
	<CAMhVC3YJK162_eJBG8PjT856LU5-7PonGhAzApYAAQRKSB3H7g@mail.gmail.com>
	<CAPE8EZ4RfNVkE-JZvyTUBpkbGsJuHQ0v9QcLdmZNM6YFaHycLw@mail.gmail.com>
	<CAMhVC3bguzQpmX2tN7WOLJ_3=Dx7H0VMyxELsb47fEecREF6rQ@mail.gmail.com>
	<CAPE8EZ4hVaYJeRGz58XJz2X2TF=y7X1bL9dSUQLJBn1wdeScFg@mail.gmail.com>

On 10/15/18 5:09 PM, Benoit Lobréau wrote:
> 
>     By the way, do/can they both use streaming to receive WAL records? Or
>     streaming is only for standby servers. For backups you have only
>     file-based log shipping?
> 
> barman supports streaming but it's not as magical as one might think.
> See pgbarman's documentation for how to manager .partial files.
> 
> pgbackrest archives only wal files when postgres uses the 
> archive_command. You also have the option to do paralllel async wal 
> push/get.
> It can be useful if you write wals quicker than you can archive them or 
> if you want to restore more quickly.

We have focused on archive_command because the performance is much 
better because it can be parallelized.

>     Then, I suppose they both don't support partial PITR
>     (http://docs.pgbarman.org/release/2.4/#scope), where there are
>     standalone backups that extends to points in time for which there are
>     no WAL files. I'm not sure if this matters, but I assume that it might
>     be effective in terms of disk space.
> 
> It's a hot backup so you have to have wals files so that your backup is 
> consistent at the end of the backup.
> You can build something like what you describe with pgbackrest, 
> archive-copy and a copy of the backup directory to another place.

The --repo1-retention-archive-type and --repo1-retention-archive options 
allow you do keep WAL for a smaller number of backups in order to save 
space.

https://pgbackrest.org/configuration.html#section-repository/option-repo-retention-archive

So, for example:

[global]
repo1-retention-full=4
# The following option is the default but included for clarity
repo1-retention-archive-type=full
repo1-retention-archive=2

This configuration will retain 4 full backups but only keep PITR WAL for 
2 of them, i.e. the WAL generated between backups.  The WAL required to 
make a backup consistent is always retained so the 2 older backups can 
be played to consistency but no further.

>     I'd like to be able to handle db failure as fast as possible. Ideally,
>     automatically. Which probably means either repmgr, or corosync +
>     pacemaker + PAF. Is that what you mean by HA here? 
> 
> 
> yes. You can also look into patrony for an alternative. It's a matter of 
> preference and requirements.

pgBackRest certainly works with Pacemaker/Corosync and Patroni.

> If your standby is lagging too far behind (and you dont use slots) you 
> can use pgbackrest's archive to fill the gap in wal files and catchup 
> with the master.

Recovering WAL out of the archive is safer than using slots.  Since the 
WAL is transferred over the network compressed it can also save a lot of 
bandwidth.

Regards,
-- 
-David
david@pgmasters.net




view thread (9+ messages)

Message-ID: <9a3bf365-5dbc-159a-e7fd-e091c0535f0a@pgmasters.net>
Permalink:  ../9a3bf365-5dbc-159a-e7fd-e091c0535f0a@pgmasters.net/
Also on:    postgresql.org/message-id/9a3bf365-5dbc-159a-e7fd-e091c0535f0a@pgmasters.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: david@pgmasters.net, benoit.lobreau@gmail.com, yuri.kanivetsky@gmail.com, ptim007@yahoo.com
  Subject: Re: Setting up continuous archiving
  In-Reply-To: <9a3bf365-5dbc-159a-e7fd-e091c0535f0a@pgmasters.net>
  References: <CAMhVC3ZYGS-tJ1LHBmYAYey+Jz8WJ5uMYVaeDLW=D-iSkf3CEg@mail.gmail.com> <307588119.3233604.1537982384823@mail.yahoo.com> <CAMhVC3YJK162_eJBG8PjT856LU5-7PonGhAzApYAAQRKSB3H7g@mail.gmail.com> <CAPE8EZ4RfNVkE-JZvyTUBpkbGsJuHQ0v9QcLdmZNM6YFaHycLw@mail.gmail.com> <CAMhVC3bguzQpmX2tN7WOLJ_3=Dx7H0VMyxELsb47fEecREF6rQ@mail.gmail.com> <CAPE8EZ4hVaYJeRGz58XJz2X2TF=y7X1bL9dSUQLJBn1wdeScFg@mail.gmail.com> <9a3bf365-5dbc-159a-e7fd-e091c0535f0a@pgmasters.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox