Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIU8v-002tn0-1R for pgsql-general@arkaria.postgresql.org; Mon, 10 Nov 2025 15:49:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vIU8q-001FFa-2Q for pgsql-general@arkaria.postgresql.org; Mon, 10 Nov 2025 15:49:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIU8q-001FFS-1I for pgsql-general@lists.postgresql.org; Mon, 10 Nov 2025 15:49:16 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vIU8o-006Om1-12 for pgsql-general@postgresql.org; Mon, 10 Nov 2025 15:49:15 +0000 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-7a4c202a30aso2494447b3a.2 for ; Mon, 10 Nov 2025 07:49:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762789753; x=1763394553; darn=postgresql.org; h=cc:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=6iE6W0q9YWryMwPUMQmCEpl767FdO8/G1eWHFfFCuTU=; b=ZKjzrhlEYcxZOjXsM/MTzrDXuTERM8eW/ePPo6oWtXXVwfZ7q+TptdBgDe946HiVd0 sneOzhnWCNyszSww3wWSEkZ6qZWovw6cL1gRojBZwv+KJ2csY6dAg/67DJDMtr8B5tXU bnI5uH6Wh/k2nPrkrFnykAFCQ10HTzrTrgLurEBftFL5EraSzjbpOynOnqKJUFZ0WkI1 /V+lztEf7SYu3N2aNuHM/ySQ8rLrExuA4ZNaPoJ/5Q0CMSS1db5SLd133QO/dXkvBl5V WyTZoOrOFYSKwBxD93YAzZR7kbVHqe7J+z+yzlzNqOxz4yjGAxnXtUTj/NKwlBsvVpOA o5rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762789753; x=1763394553; h=cc:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6iE6W0q9YWryMwPUMQmCEpl767FdO8/G1eWHFfFCuTU=; b=hxv+z+M4oAiv+GFxrF9GtxmcKLAQrhf3Hj/28LZIIviCYTYbi148O0olIHSVhgrtMK ZPHN9ZVHCz7iFAtYDchpLGlHRVzTEUwdfuoY8eAaFCYYkS4mycEK9wL16gBWJv5rv0VM IsYIubS6tQZW3ze4Bp43gInD1mRRMYG9r8BAjLOEG+xIDWVj/LatOp/ygwO/8Hua8zjA UPix2IcjYTmUVHgHBi277yBwA0NdXeF5lImbJdqiZJqaoOSAxzBEWh1/u1sLCr3tFwpK xPjXz3L3N/GSt0Y2IS3NHeQ2ViPaJwVZiKdwj9TgT0g8o6cfRXsMFmZKLQ6CvoqktSkC ce/Q== X-Gm-Message-State: AOJu0Yykm186G/4G/0BVOKOctDmL/MXdcuQhy0+kJm/IDh7+kpef+hWI gw2ffWPGFLAeXx2GQaYkqki1k8WXGC+vYr2H8iAX3DrPqFlMdVl8sZpSa6XRThkrRDKiQ+0uO6s 7bAaBEqpbztfVrD5E6HfuAvlHQM1L4laHGMUKtg4= X-Gm-Gg: ASbGncsnNc+Ewut8WLteFLnXMneVUmw8UI2qcFIa/sGRDE4sDlev9YW1lSzdcZTpNka WiIdUIiwn2y4h5hulBG/2ftB7kqQoBR91Tnt4R1ppcYUXuYDCGN2xE7yxXNW9cu3H/XK5vZ3F21 N2ET14Od3Usv0uRBrFwSiMBAOLCQwpp0lZFElPvdaEF6wLV5Q+FNP4orm9FTKGMss35KFZF40dV 9ywsDfqwZt9GHJFWcq+60aQh8qB/PkkpkqHBRfD7kKRUd0s474pnSAObD0XuGBygotvNDgPoL8u iOXBXZsA5orPsjpkY2RhvYDpZUKO X-Google-Smtp-Source: AGHT+IGLnYpgjWHimK09EsOe2/bAZ+SJHHJaih6Gcylfb2Sk7xKFQ0ccK1H+ZWjDzfdO1WpulCImlEilrPTa6OkwyHQ= X-Received: by 2002:a17:903:4b2b:b0:295:6427:87d4 with SMTP id d9443c01a7336-297e56cbe33mr103841155ad.50.1762789752887; Mon, 10 Nov 2025 07:49:12 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Radu Radutiu Date: Mon, 10 Nov 2025 17:49:00 +0200 X-Gm-Features: AWmQ_bm0VbAkvFtzgLzGec4ieuODenqBbXK4wv1q-eqzrzYV65C7vcpnQhkhB94 Message-ID: Subject: Re: Pgbackrest setup for two sites with limited bandwidth Cc: pgsql-general Content-Type: multipart/alternative; boundary="00000000000008de0706433f79d6" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000008de0706433f79d6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=E2=80=AFPM Greg Sabino Mullane 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=3Dn. p= g1-* > 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=3Dy, 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 backres= t > 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 > > --00000000000008de0706433f79d6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you. I was thinking along=C2=A0the same lines, = but I am not sure I understand why the setup will fall apart on failover. I= f 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 secon= dary to the new master followed by a local backup. Am I=C2=A0missing someth= ing obvious?

Regards,
R= adu

<= div dir=3D"ltr" class=3D"gmail_attr">On Mon, Nov 10, 2025 at 5:33=E2=80=AFP= M Greg Sabino Mullane <htamfids@gm= ail.com> wrote:
What you are asking for is tr= icky, but possible. You can setup two repos, one for each server. On the fi= rst server (in datacenter A), you have a "normal" pgbackrest conf= iguration, with an explicit backup-standby=3Dn. pg1-* points to the local s= erver, 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=C2=A0from A -> A

On datacenter B, y= ou have a separate=C2=A0local repo, a different stanza name, and within tha= t stanza, you have backup-standby=3Dy, pg1 pointing to the local pg, pg2 po= inting back to A. In the postgresql.conf, your archive-command pushes to th= is second repo, and archive_mode is "always". Backups run=C2=A0fr= om the PG server in datacenter A, but 99% of the files are actually=C2=A0co= pied from the replica in datacenter B, and goes to the backrest server in d= atacenter B. WAL is archived from B -> B.

That&= #39;s the basic idea. It falls apart rapidly if this second data center eve= r fails over.
Cheers,
Greg

--
Crunchy Data - h= ttps://www.crunchydata.com
Enterprise Postgres Software Produ= cts & Tech Support

--00000000000008de0706433f79d6--