public inbox for [email protected]  
help / color / mirror / Atom feed
Pgbackrest setup for two sites with limited bandwidth
3+ messages / 2 participants
[nested] [flat]

* Pgbackrest setup for two sites with limited bandwidth
@ 2025-11-10 12:22 Radu Radutiu <[email protected]>
  2025-11-10 15:33 ` Re: Pgbackrest setup for two sites with limited bandwidth Greg Sabino Mullane <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Radu Radutiu @ 2025-11-10 12:22 UTC (permalink / raw)
  To: pgsql-general

Hello,

Is it possible to configure pgbackrest for a postgresql server pair using
physical replication on two different sites with limited bandwidth (i.e.
sufficient for data replication but not daily backups)? All tutorials and
blogs describe a setup with either a single pgbackrest repo or multiple
repos configured on the primary server. I am looking for a solution that
has a second pgbackrest server on a secondary site that receives backups
and WALs from the standby server in order to avoid most of the additional
network traffic for backups/WALs. Is such a setup possible with pgbackrest
or other PostgreSQL backups solutions?

Best regards,
Radu


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Pgbackrest setup for two sites with limited bandwidth
  2025-11-10 12:22 Pgbackrest setup for two sites with limited bandwidth Radu Radutiu <[email protected]>
@ 2025-11-10 15:33 ` Greg Sabino Mullane <[email protected]>
  2025-11-10 15:49   ` Re: Pgbackrest setup for two sites with limited bandwidth Radu Radutiu <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Greg Sabino Mullane @ 2025-11-10 15:33 UTC (permalink / raw)
  To: Radu Radutiu <[email protected]>; +Cc: pgsql-general

What you are asking for is tricky, but possible. You can setup two repos,
one for each server. On the first server (in datacenter A), you have a
"normal" pgbackrest configuration, with an explicit backup-standby=n. pg1-*
points to the local server, pg2-* points to the replica. The repo is in
datacenter A.Backups run from PG server in datacenter A, to the backrest
repo in datacenter A. WAL is archived from A -> A

On datacenter B, you have a separate local repo, a different stanza name,
and within that stanza, you have backup-standby=y, pg1 pointing to the
local pg, pg2 pointing back to A. In the postgresql.conf, your
archive-command pushes to this second repo, and archive_mode is "always".
Backups run from the PG server in datacenter A, but 99% of the files are
actually copied from the replica in datacenter B, and goes to the backrest
server in datacenter B. WAL is archived from B -> B.

That's the basic idea. It falls apart rapidly if this second data center
ever fails over.
Cheers,
Greg

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Pgbackrest setup for two sites with limited bandwidth
  2025-11-10 12:22 Pgbackrest setup for two sites with limited bandwidth Radu Radutiu <[email protected]>
  2025-11-10 15:33 ` Re: Pgbackrest setup for two sites with limited bandwidth Greg Sabino Mullane <[email protected]>
@ 2025-11-10 15:49   ` Radu Radutiu <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Radu Radutiu @ 2025-11-10 15:49 UTC (permalink / raw)
  To: ; +Cc: pgsql-general

Thank you. I was thinking along the same lines, but I am not sure I
understand why the setup will fall apart on failover. If I also have
archive_mode always on the primary site, I think that I just need to
pg_rewind (or PITR restore) old primary and configure it as a secondary to
the new master followed by a local backup. Am I missing something obvious?

Regards,
Radu

On Mon, Nov 10, 2025 at 5:33 PM Greg Sabino Mullane <[email protected]>
wrote:

> What you are asking for is tricky, but possible. You can setup two repos,
> one for each server. On the first server (in datacenter A), you have a
> "normal" pgbackrest configuration, with an explicit backup-standby=n. pg1-*
> points to the local server, pg2-* points to the replica. The repo is in
> datacenter A.Backups run from PG server in datacenter A, to the backrest
> repo in datacenter A. WAL is archived from A -> A
>
> On datacenter B, you have a separate local repo, a different stanza name,
> and within that stanza, you have backup-standby=y, pg1 pointing to the
> local pg, pg2 pointing back to A. In the postgresql.conf, your
> archive-command pushes to this second repo, and archive_mode is "always".
> Backups run from the PG server in datacenter A, but 99% of the files are
> actually copied from the replica in datacenter B, and goes to the backrest
> server in datacenter B. WAL is archived from B -> B.
>
> That's the basic idea. It falls apart rapidly if this second data center
> ever fails over.
> Cheers,
> Greg
>
> --
> Crunchy Data - https://www.crunchydata.com
> Enterprise Postgres Software Products & Tech Support
>
>


^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2025-11-10 15:49 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-11-10 12:22 Pgbackrest setup for two sites with limited bandwidth Radu Radutiu <[email protected]>
2025-11-10 15:33 ` Greg Sabino Mullane <[email protected]>
2025-11-10 15:49   ` Radu Radutiu <[email protected]>

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