Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1frpyd-0003Nd-LQ for pgsql-admin@arkaria.postgresql.org; Mon, 20 Aug 2018 19:36:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1frpyb-0001oU-M6 for pgsql-admin@arkaria.postgresql.org; Mon, 20 Aug 2018 19:36:33 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1frpyb-0001oM-6Z for pgsql-admin@lists.postgresql.org; Mon, 20 Aug 2018 19:36:33 +0000 Received: from mail.thelabyrinth.net ([45.56.70.56]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1frpyY-0002f5-7J for pgsql-admin@postgresql.org; Mon, 20 Aug 2018 19:36:32 +0000 Received: from Davids-iMac.local (c-73-39-99-224.hsd1.va.comcast.net [73.39.99.224]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dsteele) by mail.thelabyrinth.net (Postfix) with ESMTPSA id 9FDC45461E; Mon, 20 Aug 2018 19:36:28 +0000 (UTC) Subject: Re: pgbackrest: backup from standby To: Craig James , pgsql-admin@postgresql.org References: From: David Steele Openpgp: preference=signencrypt Autocrypt: addr=david@pgmasters.net; prefer-encrypt=mutual; keydata= xsFNBFSheh0BEADGNb3c1kOaX5OGUDhqHTwJ3JW7XAllfWLdknpRg+/fihgLPPRnQHZhjq28 nmMLqM+C8TjezT2BgVACeu8qqASnuzN/E5+bAl9hVcgCP4eV/lEIWwVxmhcHqSdeWqWZSBRB tf07fLBnz22+3LwVsESN+fanWx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xuDTQp35PIwRsL59xNmPICu0ae6zmCPUpxbMIEzb/VU wXqeuNp3cRVll06goDt5w+2LlAtBrxuDjiWxby9LH+vsIUMLWYu+M50pdtOcXOsO1+zyfs3w U6xRZ3PaFDKO1cB68okDFG/cFHnYfY5aETV7LgVBHEOQLwL01U01QC/iqY/aNO4iUH/+PBc0 R6mYlP7IqDQOQVTJ0dXP365thl0Q7c9e2JQSS9wuSv2EEiR//nnZREtLyrQNLwsXE8UFBDe7 uA8Lm2ldmQYpHHKAcorGVTHYJaaus2LjH8tZ1i4RGg4hKMJSHil/5C+Ghl+PmcACVeGaxB0c mJ8+0jyWDkLCDMAXJJyvXRWIONTAxVt5kKg1/iMAq1IQYNd66agnmgxdSvKLPUo0JJ5fhQJp 2bqDDTrINTZg+Rub2HeoOMxYJsMypK+6aY4iVlm2Z7A9SgyQDjGAXzD9+XaezNFeXxfPbjo6 46qA9SycdYhiwaTcTQakiLkZWRIkSjGQwNCK9NktE1fYnXfR0+WaWFduQ4BfM5uta1bt8esB /mLEjVYS9RRAWZ/untJrR9JYGTC4Mu6tcLGZD7385yX3TNM1iaIUGxlKkHHCZCnILyo= Message-ID: Date: Mon, 20 Aug 2018 15:36:27 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 8/20/18 12:12 PM, Craig James wrote: > The pgbackrest documentation has a section on backing up from a standby, > but I'm having trouble figuring it out. I think it's just a terminology > problem: I can't figure out which configuration directives go on which > server. > > To begin with, I already have streaming replication running: > > Primary server (live database): "radon" > > [emolecules] >   db-path=/var/lib/postgresql/9.6/main > > [global] >   repo-path=/pg_archive/pgbackrest >   retention-full=10 >   backup-user=postgres >   log-level-file=detail > > > Hot-standby server: "standby" > > [emolecules] >   db-path=/var/lib/postgresql/9.6/main >   recovery-option=standby_mode=on > >  [global] >   backup-host=radon.emolecules.com >   backup-user=postgres It's much easier just to mount the nfs volume to the standby and then you can use the same configuration on the primary and standby, though I can see below you have reasons not to do that. > The standby server is on Amazon AWS, and I want to set up a backup > Amazon S3 archive that gets its snapshot and WAL files from the standby > in order to save bandwidth costs from the primary (don't want to copy > the data twice). This is not supported. If you enable "archive_mode=always" pgBackRest will complain because there's no way to ensure that multiple server are not archiving, especially on S3. > Note that the primary is also archived to a local NFS disk. I want to > keep that going, too, but create a second archive on S3. (The reason for > this is that we're migrating from our own hardware to AWS, and during > the transition need both systems fully functional.) It's possible to backup/archive to multiple repos but the configuration is complex. I recommend that you migrate your pgBackRest repo to S3 first. That goes like: 1) Sync the pgbackrest repo to S3 (using s3fs) 2) Stop archiving by setting archive_command=false 3) Sync the pgbackrest repo again to catch any files that were missed the first time. 4) Reconfigure for S3 and enable archiving. > There are sections in the user guide on /Backup from a Standby > / and on /S3 > Support /, but I > can't sort out how to combine them. Apparently I need to define > pg1-host/pg1-path, and pg2-host/pg2-path, then a stanza for S3. But does > all this go in the pgbackrest.conf of the primary ("radon" in my case), > or on the standby, or somehow split across both? You have an asymmetrical configuration here since there is not backup server and shown in the pgBackRest docs. That makes configuration quite a bit harder and make failover harder. > Another question: if I modify these files, will the current standby > replica keep streaming properly? That is, can I add the S3 repository to > the current primary/standby pair without having to start over? Yes, but multiple repositories are not natively support at this time so it requires multiple configurations and some care. Regards, -- -David david@pgmasters.net