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 1gC76q-0001a9-5R for pgsql-general@arkaria.postgresql.org; Mon, 15 Oct 2018 17:56:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gC76o-0008Da-Gm for pgsql-general@arkaria.postgresql.org; Mon, 15 Oct 2018 17:56:50 +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 1gC76o-0008DT-4j for pgsql-general@lists.postgresql.org; Mon, 15 Oct 2018 17:56:50 +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 1gC76l-0005w6-5G for pgsql-general@lists.postgresql.org; Mon, 15 Oct 2018 17:56:48 +0000 Received: from Davids-MacBook.local (unknown [196.196.232.5]) (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 D1CF754675; Mon, 15 Oct 2018 17:56:44 +0000 (UTC) Subject: Re: Setting up continuous archiving To: =?UTF-8?Q?Benoit_Lobr=c3=a9au?= , yuri.kanivetsky@gmail.com Cc: ptim007@yahoo.com, pgsql-general@lists.postgresql.org References: <307588119.3233604.1537982384823@mail.yahoo.com> From: David Steele Message-ID: <9a3bf365-5dbc-159a-e7fd-e091c0535f0a@pgmasters.net> Date: Mon, 15 Oct 2018 18:56:41 +0100 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; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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