Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jcvlT-0005lM-Qf for pgsql-general@arkaria.postgresql.org; Sun, 24 May 2020 18:54:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jcvlS-00053R-Ib for pgsql-general@arkaria.postgresql.org; Sun, 24 May 2020 18:54:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jcvTs-0008Aj-Ix for pgsql-general@lists.postgresql.org; Sun, 24 May 2020 18:36:17 +0000 Received: from ip27.imatronix.com ([200.63.97.108]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jcvTn-0005jg-2V for pgsql-general@postgresql.org; Sun, 24 May 2020 18:36:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=superfactura.cl; s=default; h=Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=gBea9iwKFRrvMwX2a/tsI2HMjHSOuTREiUhSznMAVI4=; b=jsJh0Co8MjPlyNe6G6g/adu+y FOzCSfHvV9orDlzwkr9VmIx9RZ2AiyJ2GWJJmSYC6NC88JggPPjgKluPdj9gRbdiRi8FRXhMPOfIn LpT3DyE5utfHQtNVNV5yEOF8R1UEIaD/u92ZqzVNXbNfzfn5ZKcVtwB2Z0q7GOKl2W2eaws9mxMm3 4Tu8aocm1OeDlVeNctF9nqHFDtpwhrVIKmyVxMRjmEvFB1zv4o11hgTAcT/h+PW4gkKioXJbAlslf PHIt3qDwLE5+oUnS00o4H5ZLjfka5Ru+OuQ7KjKGUGHL5CMiLU3Sqx7TR3XorNZQxYlDMHUzRsZOH 1e7ysB6Pw==; Received: from [200.73.112.45] by cpanel.imatronix.com with esmtpsa (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.93) (envelope-from ) id 1jcvTf-0001bb-LA ; Sun, 24 May 2020 14:36:03 -0400 Subject: Re: pg_basebackup + incremental base backups To: Stephen Frost Cc: pgsql-general@postgresql.org References: <514b14cb-f0b8-157b-2755-d5170ed4d24b@imatronix.cl> <20191204030907.GB6962@tamriel.snowman.net> <367ee69d-9dc7-4de6-f8a1-b460567bcc07@imatronix.cl> <20200521124303.GV3418@tamriel.snowman.net> From: Christopher Pereira Organization: IMATRONIX S.A. Message-ID: <03f63a68-14be-978a-ccc8-177a84f115a5@imatronix.cl> Date: Sun, 24 May 2020 14:36:01 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200521124303.GV3418@tamriel.snowman.net> Content-Type: multipart/alternative; boundary="------------FBB341545E786AB78AA02745" Content-Language: en-US X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpanel.imatronix.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - imatronix.cl X-Get-Message-Sender-Via: cpanel.imatronix.com: authenticated_id: soporte@superfactura.cl X-Authenticated-Sender: cpanel.imatronix.com: soporte@superfactura.cl X-Source: X-Source-Args: X-Source-Dir: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------FBB341545E786AB78AA02745 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit > We've contemplated adding support for something like this to pgbackrest, > since all the pieces are there, but there hasn't been a lot of demand > for it and it kind of goes against the idea of having a proper backup > solution, really.. It'd also create quite a bit of load on the primary > to checksum all the files to do the comparison against what's on the > replica that you're trying to update, so not something you'd probably > want to do a lot more than necessary. Ok, we want to use pgbackrest to *rebuild a standby that has fallen behind* (where pg_rewind won't work). After reading the docs, we believe we should use this setup: a) Primary host: primary cluster b) Repository host: needed for rebuilding the standby (and having PITR as bonus). c) Standby host: standby cluster Some questions: 1) The standby will use streaming replication and will be in sync until someday something funny happens and both standby and repository get out of sync with the primary. Now, to rebuild the standby first we will have to create a new backup transferring the data from *primary -> repository*, right? Wouldn't this also have a load impact on the primary cluster? 2) In the user guide section 17.3 is explained how to create a "pg-standby host" to replicate the data *from the repository host*. And in section 17.4 is explained how to setup Streaming Replication to replicate the data *from the primary host*. Do 17.3 and 17.4 work together so that the data is *replicated from the repository* and then *streamed from the primary*? 3) Before being able to rebuild the standby cluster, would we first need to update the backup on the repository (backup from primary -> repository) in order for streaming replication to work (from primary -> standby)? 4) Once the backup on the repository is ready, what are the chances that streaming replication from primary to standby won't work because they got out of sync again? 5) Could we just work with 2 hosts (primary and standby) instead of 3? FAQ section 8 says the repository shouldn't be on the same host as the standby and having it on the primary doesn't make much sense because if the primary host is down we won't have access to the backup. It would be ideal to have the repository on the standby host and taking good care of the configurations. What exactly should be cared of for this setup to be safe? I'm afraid I'm not understanding very well the pgbackrest design or how to use it efficiently to rebuild a standby cluster that got out of sync. --------------FBB341545E786AB78AA02745 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 7bit
We've contemplated adding support for something like this to pgbackrest,
since all the pieces are there, but there hasn't been a lot of demand
for it and it kind of goes against the idea of having a proper backup
solution, really..  It'd also create quite a bit of load on the primary
to checksum all the files to do the comparison against what's on the
replica that you're trying to update, so not something you'd probably
want to do a lot more than necessary.

Ok, we want to use pgbackrest to rebuild a standby that has fallen behind (where pg_rewind won't work). After reading the docs, we believe we should use this setup:

a) Primary host: primary cluster

b) Repository host: needed for rebuilding the standby (and having PITR as bonus).

c) Standby host: standby cluster

Some questions:

1) The standby will use streaming replication and will be in sync until someday something funny happens and both standby and repository get out of sync with the primary.
Now, to rebuild the standby first we will have to create a new backup transferring the data from primary -> repository, right?
Wouldn't this also have a load impact on the primary cluster?

2) In the user guide section 17.3 is explained how to create a "pg-standby host" to replicate the data from the repository host.
And in section 17.4 is explained how to setup Streaming Replication to replicate the data from the primary host.
Do 17.3 and 17.4 work together so that the data is replicated from the repository and then streamed from the primary?

3) Before being able to rebuild the standby cluster, would we first need to update the backup on the repository (backup from primary -> repository) in order for streaming replication to work (from primary -> standby)?

4) Once the backup on the repository is ready, what are the chances that streaming replication from primary to standby won't work because they got out of sync again?

5) Could we just work with 2 hosts (primary and standby) instead of 3?
FAQ section 8 says the repository shouldn't be on the same host as the standby and having it on the primary doesn't make much sense because if the primary host is down we won't have access to the backup.

It would be ideal to have the repository on the standby host and taking good care of the configurations. What exactly should be cared of for this setup to be safe?

I'm afraid I'm not understanding very well the pgbackrest design or how to use it efficiently to rebuild a standby cluster that got out of sync.

--------------FBB341545E786AB78AA02745--