<?xml version="1.0" encoding="UTF-8" ?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" version="2.0"><channel><title>Sarah Conway Schnurr | CrunchyData Blog</title>
<atom:link href="https://www.crunchydata.com/blog/author/sarah-conway-schnurr/rss.xml" rel="self" type="application/rss+xml" />
<link>https://www.crunchydata.com/blog/author/sarah-conway-schnurr</link>
<image><url>https://www.crunchydata.com/build/_assets/default.png-W4XGD4DB.webp</url>
<title>Sarah Conway Schnurr | CrunchyData Blog</title>
<link>https://www.crunchydata.com/blog/author/sarah-conway-schnurr</link>
<width>256</width>
<height>256</height></image>
<description>PostgreSQL experts from Crunchy Data share advice, performance tips, and guides on successfully running PostgreSQL and Kubernetes solutions</description>
<language>en-us</language>
<pubDate>Wed, 27 Feb 2019 04:00:00 EST</pubDate>
<dc:date>2019-02-27T09:00:00.000Z</dc:date>
<dc:language>en-us</dc:language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<item><title><![CDATA[ pgBackRest - Performing Backups on a Standby Cluster ]]></title>
<link>https://www.crunchydata.com/blog/pgbackrest-performing-backups-on-a-standby-cluster</link>
<description><![CDATA[ Disaster recovery and backup tools like pgBackRest help ensure the high-availability of PostgreSQL, but there are cases where you do not want run them on your primary, such as due to I/O constraints or archiving a replica in another data center. This guide shows how to run pgBackRest with a replica. ]]></description>
<content:encoded><![CDATA[ <p><a href=https://www.pgbackrest.org>pgBackRest</a> is an open source tool designed for efficiently performing backups and restores for <a href=https://www.postgresql.org>PostgreSQL</a> on up to terabytes of data at a time. Its aim is to be reliable, scalable, and flexible while offering robust performance during the backup process.<p>Many powerful features are included in pgBackRest, including <a href=https://pgbackrest.org/user-guide.html#parallel-backup-restore>parallel backup and restore</a>, local or remote operation, <a href=https://pgbackrest.org/user-guide.html#concept/backup>full, incremental, and differential backup types</a>, backup rotation, archive expiration, backup integrity, page checksums, backup resume, streaming compression and checksums, <a href=https://pgbackrest.org/user-guide.html#restore/option-delta>delta restore</a>, and much more.<p>A difficult scenario which may present itself to database engineers is ensuring the <a href=https://www.crunchydata.com/products/crunchy-high-availability-postgresql>high availability of your PostgreSQL cluster</a>, which includes ensuring all backups are performing consistently and well without impacting the primary database host. Occasionally, you may experience a substantial system load on the primary database whenever a pgBackRest backup is running if you have a sizable enough amount of data.<p>An effective solution to this issue is to enable the option to enable the performance of backups from the replica rather than the primary; the bulk of the impact to I/O then occurs on the replica node and minimizes the load on the primary host. The only connections being made at that point would be from the replica to the primary in order to obtain information and log files.<p>It is additionally possible to configure more than one replica to work with pgBackRest; in this case, the first running standby found will be chosen and used for the backup process. If one of the standby nodes fail, pgBackRest will automatically find and proceed to run the backup on the next available replica that is configured.<p>Please note that the ability to define more than one standby was not available until version 1.23 of pgBackRest; in this version, multiple standby support was introduced that allows up to seven replicas to be configured rather than the limit of two from prior to that release. See the release notes <a href=https://pgbackrest.org/release.html#1.23>here</a>.<p>Additionally, if you are following this guide with the intent of configuring it for your current cluster and your version of pgBackRest is prior to version 2, please note that any configuration parameters beginning in “pg” <em>will need to be re-referenced as “db”</em>.<p>Specific documentation from pgBackRest’s official website for configuring the backup from standby option in version 1 can be found <a href=https://pgbackrest.org/1/configuration.html#section-backup/option-backup-standby>here</a>.<p>In the following guide, we will explore configuring pgBackRest on two separate CentOS 7 servers and enabling the ability to backup PostgreSQL from the replica.<h2 id=configure-the-virtual-machines><a href=#configure-the-virtual-machines>Configure the Virtual Machines</a></h2><p>If following this guide exclusively for tutorial purposes, it may be useful to follow the same settings as were used while documenting the exercise.<p>For this example, two virtual machines were created using <a href=https://www.virtualbox.org/>VirtualBox</a>. An .iso of the latest release of <a href=https://www.centos.org/download/>CentOS 7</a> was used for installation of the operating system. One is an exact “full clone” of the other, so all settings and configurations as follows are replicated for both machines:<ul><li>12 GB single partition ext4 hard disk<li>2 GB RAM<li>1 CPU</ul><p><a href=https://www.brianlinkletter.com/how-to-use-virtualbox-to-emulate-a-network/>This guide</a> was followed when configuring the two virtual machines to use an internal network for communicating.<h2 id=nfs-configuration><a href=#nfs-configuration>NFS Configuration</a></h2><p>Both machines in this tutorial are configured with the NFS shared storage system, following the directions found <a href=https://www.itzgeek.com/how-tos/linux/centos-how-tos/how-to-setup-nfs-server-on-centos-7-rhel-7-fedora-22.html>here</a>. The NFS folder configured for this example is located at /pgbackrest-nfs on the <strong>primary</strong> and /mnt/pgbackrest-nfs on the <strong>replica</strong>.<h2 id=install-postgresql-and-pgbackrest><a href=#install-postgresql-and-pgbackrest>Install PostgreSQL and pgBackRest</a></h2><p>There are several methods for installing PostgreSQL on a CentOS 7 server that are detailed on the <a href=https://wiki.postgresql.org/wiki/YUM_Installation>PostgreSQL wiki</a>. For the purposes of this guide, we will install both PostgreSQL 11 and the latest version of pgBackRest using the <a href=https://yum.postgresql.org>PGDG Yum repository</a>. At the time of this writing, the pgBackRest installation resulted in version 2.10.<p>On <strong>both</strong> the primary and the replica servers, run the following commands:<pre><code class=language-shell>sudo yum -y install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm
sudo yum -y install postgresql11-server postgresql11-contrib pgbackrest
</code></pre><p>Next, on the <strong>primary</strong>, it will be necessary to initialize a PostgreSQL cluster with the following commands.<pre><code class=language-shell>sudo /usr/pgsql-11/bin/postgresql-11-setup initdb
sudo systemctl enable postgresql-11
sudo systemctl start postgresql-11
</code></pre><p>The first command is only necessary to run once, and is responsible for initializing the database in PGDATA. The second will ensure PostgreSQL will start automatically when the operating system is turned on, and the third will start the database at the present time.<p>To verify the pgBackRest installation, either pgbackrest or pgbackrest version can be called as either the default user or the postgres user.<pre><code class=language-shell>$ pgbackrest
pgBackRest 2.10 - General help
Usage:
pgbackrest [options] [command]
Commands:
archive-get Get a WAL segment from the archive.
archive-push Push a WAL segment to the archive.
backup Backup a database cluster.
check Check the configuration.
expire Expire backups that exceed retention.
help Get help.
info Retrieve information about backups.
restore Restore a database cluster.
stanza-create Create the required stanza data.
stanza-delete Delete a stanza.
stanza-upgrade Upgrade a stanza.
start Allow pgBackRest processes to run.
stop Stop pgBackRest processes from running.
version Get version.
</code></pre><p>Use 'pgbackrest help [command]' for more information.<p>To verify PostgreSQL has installed and started correctly, at this point in time, you can check the version of the PostgreSQL command line tool:<pre><code class=language-shell>$ sudo -iu postgres psql --version
psql (PostgreSQL) 11.2
</code></pre><h2 id=configure-replication-from-the-primary><a href=#configure-replication-from-the-primary>Configure Replication from the Primary</a></h2><p>At this point, it’s necessary to configure streaming replication between the primary and the replica. If you’re unaware of where your configuration files are, on the <strong>primary</strong>, you can run the following:<pre><code class=language-shell>$ sudo -iu postgres psql -U postgres -c 'SHOW config_file'
config_file
----------------------------------------
/var/lib/pgsql/11/data/postgresql.conf
(1 row)
</code></pre><p>On the <strong>primary</strong>, edit the <a href=https://www.postgresql.org/docs/current/runtime-config.html>postgresql.conf</a> file with root privileges with your preferred text editor. The following parameters will need to be uncommented and set:<pre><code class=language-ini>listen_addresses = '*'
password_encryption=’scram-sha-256’
archive_mode = on
</code></pre><p>As an additional note, for a more secure setup, listen_addresses can be set for the IP address of the current host. For the purposes of this example, that IP is 10.10.10.1.<pre><code class=language-ini>listen_addresses = '10.10.10.1'
</code></pre><p>While <a href=https://www.postgresql.org/docs/current/auth-pg-hba-conf.html>pg_hba.conf</a> is the file responsible for restricting connections, when listen_addresses is set for ‘*’, an attacker would be able to discover the open port on 5432 using nmap and know it exists, thereby possibly opening the server up for an exploit. Setting it to the exact IP address prevents PostgreSQL from listening on an unintended interface, preventing this potential exploit. More information on this specific attack vector and how to avoid it can be found in <a href=https://postgresql.verite.pro/blog/2019/02/08/open-instances.html>this blog post</a>.<p>As an additional note regarding password_encryption - <a href=https://www.postgresql.org/docs/current/auth-password.html>SCRAM-SHA-256 authentication</a> was added in PostgreSQL 10, and is used in this example for the purposes of encouraging secure connections in your cluster. Specifically, this method of authentication prevents password sniffing on untrusted connections and offers support for cryptographically hashing passwords on the server in a secure manner. More detailed information on this authentication method can be found <a href=https://www.postgresql.org/docs/11/auth-password.html>here</a>.<p>In the major release for PostgreSQL 10, a change was introduced to reduce the configuration edits that were necessary to perform streaming backup and replication (specifically affecting the parameters wal_level, max_wal_senders, max_replication_slots, and hot_standby - these are now all set by default). The release notes regarding this change can be found <a href=https://www.postgresql.org/docs/10/release-10.html>here</a>.<p>Because of this, prior to PostgreSQL version 10.0, the following parameters will additionally need to be set in the configuration file.<pre><code class=language-shell>max_wal_senders=3
wal_level='replica'
</code></pre><p>We’ll now restart PostgreSQL to allow the changes to postgresql.conf to take effect.<pre><code class=language-shell>sudo systemctl restart postgresql-11
</code></pre><p>It is required to restart the cluster here, rather than reload, as all of the particular values changed above require a restart to cause them to take effect. That particular attribute for the values can be checked by running the following commands.<pre><code class=language-shell>sudo -iu postgres psql
</code></pre><pre><code class=language-pgsql>SELECT name,setting,context,source FROM pg_settings WHERE NAME IN ('listen_addresses',’archive_mode’,'password_encryption');
name | setting | context | source
---------------------+---------------+------------+--------------------
listen_addresses | 10.10.10.1 | postmaster | configuration file
archive_mode | on | postmaster | configuration file
password_encryption | scram-sha-256 | user | configuration file

(3 rows)
</code></pre><p>As you can see in the above output, the context for listen_addresses and archive_mode is set to postmaster. Any setting that has the context of postmaster will require a full restart of the PostgreSQL cluster before it will take effect. Settings that have the context of sighup require only a reload of the database, and the context of user indicates the changes will take place in the same user session. More information on pg_settings can be found in the <a href=https://www.postgresql.org/docs/current/view-pg-settings.html>PostgreSQL documentation</a>.<p>Next, create a user that will be used uniquely for the purposes of replication:<pre><code class=language-shell>sudo -iu postgres psql
</code></pre><pre><code class=language-pgsql>CREATE USER replicate REPLICATION LOGIN CONNECTION LIMIT 1 ENCRYPTED PASSWORD 'mypassword';
CREATE ROLE
</code></pre><p>The password can be set to any passphrase of your choosing. Alternatively, if you prefer to keep the passphrase not visible in the command line history:<pre><code class=language-pgsql>CREATE ROLE replicate WITH REPLICATION LOGIN;
CREATE ROLE
\password replicate
Enter new password:
Enter it again:
</code></pre><p>Next, it’s necessary to add the following line to pg_hba.conf on the <strong>primary</strong> server under “IPv4 Local Connections”. Similarly to before, the location of the pg_hba.conf file can be found in the following manner:<pre><code class=language-shell>$ sudo -iu postgres psql -U postgres -c 'SHOW hba_file'
hba_file
------------------------------------
/var/lib/pgsql/11/data/pg_hba.conf
(1 row)
</code></pre><p>The following line permits the replication user to connect through the replica server, with their authentication being verified with the scram-sha-256 authentication method. Make sure to replace the IP address with that of the replica server.<pre><code class=language-text>host replication replicate 10.10.10.2/32 scram-sha-256
</code></pre><p>We are following the secure standard set earlier in this guide of using scram-sha-256 for authentication purposes; however, the different authentication methods available for pg_hba.conf are available for perusal in the <a href=https://www.postgresql.org/docs/current/auth-pg-hba-conf.html>PostgreSQL documentation</a>.<p>Next, reload the cluster to allow the changes made above to take effect:<pre><code class=language-shell>sudo systemctl reload postgresql-11
</code></pre><h2 id=configure-pgbackrest-on-the-primary><a href=#configure-pgbackrest-on-the-primary>Configure pgBackRest on the Primary</a></h2><p>Next, we’ll need to initialize pgBackRest on the <strong>primary</strong>. As good practice, first backup the existing pgbackrest.conf file:<pre><code class=language-shell>sudo cp /etc/pgbackrest.conf /etc/pgbackrest.conf.backup
</code></pre><p>Edit pgbackrest.conf with the editor of your choosing and configure it with the following parameters.<pre><code class=language-ini>[global]
repo1-path=/pgbackrest-nfs
repo1-retention-full=2
log-level-console=info
log-level-file=debug

[demo]
pg1-path=/var/lib/pgsql/11/data
</code></pre><p>The <code>[global]</code> section defines the location of the backups and the logging settings.<p><code>[demo]</code> defines a new stanza which we will create later on, and defines the path.<p>More information on the above parameters and other options for configuring your pgBackRest configuration file can be found in the <a href=https://pgbackrest.org/configuration.html>pgBackRest Configuration guide</a>.<p>Then, edit postgresql.conf and uncomment and set the following parameters:<pre><code class=language-ini>archive_command = 'pgbackrest --stanza=demo archive-push %p'
</code></pre><p>Reload the PostgreSQL cluster using systemctl to allow the change to take effect.<p>Next, let’s initialize the pgBackRest stanza, which contains the definitions for the location, archiving options, backup settings, and other similar configurations for the PostgreSQL database cluster. There is generally one stanza defined for each database cluster that needs to have backups. The stanza-create command must be run on the <strong>primary</strong> host after pgbackrest.conf has been configured.<pre><code class=language-shell>$ sudo -u postgres pgbackrest --stanza=demo stanza-create
2019-02-11 07:17:10.538 P00 INFO: stanza-create command begin 2.10: --log-level-console=info --log-level-file=off --pg1-path=/var/lib/pgsql/11/data --repo1-path=/pgbackrest-nfs --stanza=demo
2019-02-11 07:17:11.179 P00 INFO: stanza-create command end: completed successfully (642ms)
</code></pre><p>You may see a warning at the top of the output, similar to the following:<pre><code class=language-text>WARN: unable to open log file '/var/log/pgbackrest/demo-stanza-create.log': Permission denied
NOTE: process will continue without log file.
</code></pre><p>If you see this, check the permissions on the /var/log/pgbackrest folder. You may find you need to change the owner; this should resolve the above error.<pre><code class=language-shell>chown postgres:postgres /var/log/pgbackrest
</code></pre><p>Finally, we’ll check the cluster using the pgbackrest check command; this validates that pgBackRest and the archive_command settings are both accurately configured and performing as expected. More information on the pgbackrest check command can be found on the <a href=https://pgbackrest.org/command.html#command-check>pgBackRest Commands documentation</a>.<pre><code class=language-shell>$ sudo -iu postgres pgbackrest --stanza=demo check
2019-02-11 07:20:00.548 P00 INFO: check command begin 2.10: --log-level-console=info --log-level-file=debug --pg1-path=/var/lib/pgsql/11/data --repo1-path=/pgbackrest-nfs --stanza=demo
2019-02-11 07:20:03.066 P00 INFO: WAL segment 000000010000000000000001 successfully stored in the archive at '/pgbackrest-nfs/archive/demo/11-1/0000000100000000/000000010000000000000001-64482872a5d9916e751dbcf39e441ac554a97abc.gz'
2019-02-11 07:20:03.067 P00 INFO: check command end: completed successfully (2520ms)
</code></pre><h2 id=configure-passwordless-ssh><a href=#configure-passwordless-ssh>Configure Passwordless SSH</a></h2><p>Next, it’s necessary to set up a SSH connection between the hosts to ensure they can communicate properly. Run the following commands on the <strong>replica</strong> host:<pre><code class=language-shell>sudo useradd --system --home-dir "/var/lib/pgbackrest" --comment "pgBackRest user" backrest
sudo chmod 700 /var/lib/pgbackrest
sudo chown backrest:backrest /var/lib/pgbackrest
sudo chown backrest:backrest /var/log/pgbackrest
</code></pre><p>Continuing to apply these commands to the <strong>replica</strong> server, create the SSH keys for the postgres user and verify the correct SELinux contexts:<pre><code class=language-shell>sudo -u backrest ssh-keygen -N "" -t rsa -b 4096 -f /var/lib/pgbackrest/.ssh/id_rsa
sudo -u backrest restorecon -R /var/lib/pgbackrest/.ssh
</code></pre><p>On the <strong>primary</strong> server, repeat the above actions for the postgres user:<pre><code class=language-shell>sudo -u postgres ssh-keygen -N "" -t rsa -b 4096 -f /var/lib/pgsql/.ssh/id_rsa
sudo -u postgres restorecon -R /var/lib/pgsql/.ssh
</code></pre><p>From the <strong>primary</strong>, copy the public key <strong>from the replica</strong> (replacing the IP address below with the IP address of your <strong>replica</strong>):<pre><code class=language-shell>sudo scp root@10.10.10.2:/var/lib/pgbackrest/.ssh/id_rsa.pub /var/lib/pgsql/.ssh/authorized_keys
</code></pre><p>And repeat the same for the <strong>replica</strong> server, replacing the IP address with that of your <strong>primary</strong> host:<pre><code class=language-shell>sudo scp root@10.10.10.1:/var/lib/pgsql/.ssh/id_rsa.pub /var/lib/pgbackrest/.ssh/authorized_keys
</code></pre><p>Afterwards, you can use the following commands (run respectively from the replica server, then the primary server) to test the SSH connection is working as expected, with no password required at login.<pre><code class=language-shell>sudo -u backrest ssh postgres@10.10.10.1
sudo -u postgres ssh backrest@10.10.10.2
</code></pre><h2 id=perform-initial-backup><a href=#perform-initial-backup>Perform Initial Backup</a></h2><p>Take an initial full backup on the <strong>primary</strong> server that we will later restore from on the replica.<pre><code class=language-shell>$ sudo -u postgres pgbackrest --stanza=demo --type=full backup
2019-02-11 07:40:20.345 P00 INFO: backup command begin 2.10: --log-level-console=info --log-level-file=debug --pg1-path=/var/lib/pgsql/11/data --repo1-path=/pgbackrest-nfs --repo1-retention-full=2 --stanza=demo --type=full
2019-02-11 07:40:21.400 P00 INFO: execute non-exclusive pg_start_backup() with label "pgBackRest backup started at 2019-02-11 07:40:20": backup begins after the next regular checkpoint completes
2019-02-11 07:40:21.631 P00 INFO: backup start archive = 000000010000000000000003, lsn = 0/3000028
2019-02-11 07:40:24.187 P01 INFO: backup file /var/lib/pgsql/11/data/base/13881/1255 (608KB, 2%) checksum ebc82159c9d12759c60445f1b8715bc492853bbd
[OUTPUT TRUNCATED]
2019-02-11 07:40:42.686 P00 INFO: full backup size = 23.4MB
2019-02-11 07:40:42.686 P00 INFO: execute non-exclusive pg_stop_backup() and wait for all WAL segments to archive
2019-02-11 07:40:42.802 P00 INFO: backup stop archive = 000000010000000000000003, lsn = 0/3000130
2019-02-11 07:40:43.631 P00 INFO: new backup label = 20190211-074020F
2019-02-11 07:40:43.737 P00 INFO: backup command end: completed successfully (23393ms)
2019-02-11 07:40:43.737 P00 INFO: expire command begin
2019-02-11 07:40:43.754 P00 INFO: full backup total &#60 2 - using oldest full backup for 11-1 archive retention
2019-02-11 07:40:43.761 P00 INFO: expire command end: completed successfully (24ms)
</code></pre><h2 id=configure-pgbackrest-on-the-replica><a href=#configure-pgbackrest-on-the-replica>Configure pgBackRest on the Replica</a></h2><p>Configure /etc/pgbackrest.conf on the replica with the following content.<pre><code class=language-ini>[global]
repo1-path=/mnt/pgbackrest-nfs
repo1-retention-full=2
log-level-console=info
log-level-file=debug
delta=y

[demo]
pg1-host=10.10.10.1
pg1-path=/var/lib/pgsql/11/data
recovery-option=standby_mode=on
recovery-option=primary_conninfo=host=10.10.10.1 user=replicate
recovery-option=recovery_target_timeline=latest
</code></pre><p>Now, initialize the PostgreSQL cluster:<pre><code class=language-shell>sudo /usr/pgsql-11/bin/postgresql-11-setup initdb
</code></pre><p>Finally, restore the backup taken from the primary server.<pre><code class=language-shell>$ sudo -u postgres pgbackrest --stanza=demo restore
2019-02-11 08:03:55.573 P00 INFO: restore command begin 2.10: --delta --log-level-console=info --log-level-file=off --pg1-path=/var/lib/pgsql/11/data --repo1-path=/mnt/pgbackrest-nfs --stanza=demo
2019-02-11 08:03:55.861 P00 INFO: restore backup set 20190211-074020F
2019-02-11 08:03:56.467 P00 INFO: remove invalid files/paths/links from /var/lib/pgsql/11/data
2019-02-11 08:03:56.824 P00 INFO: cleanup removed 3 files
2019-02-11 08:03:57.594 P01 INFO: restore file /var/lib/pgsql/11/data/base/13881/1255 (608KB, 2%) checksum ebc82159c9d12759c60445f1b8715bc492853bbd
2019-02-11 08:03:57.604 P01 INFO: restore file /var/lib/pgsql/11/data/base/13880/1255 (608KB, 5%) checksum ebc82159c9d12759c60445f1b8715bc492853bbd
...
2019-02-11 08:04:13.647 P01 INFO: restore file /var/lib/pgsql/11/data/current_logfiles (30B, 99%) checksum 3e879a8ee40722437310e7d18b134c5397663490
2019-02-11 08:04:14.098 P00 INFO: write /var/lib/pgsql/11/data/recovery.conf
2019-02-11 08:04:14.101 P00 INFO: restore global/pg_control (performed last to ensure aborted restores cannot be started)
2019-02-11 08:04:14.108 P00 INFO: restore command end: completed successfully (18536ms)
</code></pre><p>Above, we configured pgBackRest to automatically restore using the --delta option; this will enable backing up using checksums rather than timestamps to determine if the files should be copied. Additionally, by default when restoring, pgBackRest will require the database data directory to be cleaned before performing the restore. The delta option enables pgBackRest to automatically determine which files to preserve or restore, and removes files not present in the backup manifest.<p>Before starting the PostgreSQL cluster, it’s necessary to ensure listen_addresses is set to the correct parameter if it was set to a specific IP address on the primary earlier on. The reason for this is when you restore from a backup, it will also automatically restore all PostgreSQL configuration files from the original host - therefore, when we attempt to start the PostgreSQL server on the replica, it will attempt to assign the wrong IP address.<p>Next, we’ll enable and start the PostgreSQL service.<pre><code class=language-shell>sudo systemctl enable postgresql-11
sudo systemctl start postgresql-11
</code></pre><p>You can verify everything is successfully running by entering the following command:<pre><code class=language-shell>sudo systemctl status postgresql-11
</code></pre><p>Now, on the replica, adjust the /etc/pgbackrest.conf file:<pre><code class=language-ini>[global]
repo1-path=/mnt/pgbackrest-nfs
repo1-retention-full=2
log-level-console=info
log-level-file=debug
backup-standby=y
delta=y

[demo]
pg1-host=10.10.10.1
pg1-path=/var/lib/pgsql/11/data
pg2-path=/var/lib/pgsql/11/data
recovery-option=standby_mode=on
recovery-option=primary_conninfo=host=10.10.10.1 user=replicate
recovery-option=recovery_target_timeline=latest
</code></pre><p>On the replica, you should now be able to successfully check the full backup that was taken earlier and perform additional backups for the database located on the primary host.<pre><code class=language-shell>$ sudo -u backrest pgbackrest info
stanza: demo
status: ok
cipher: none

db (current)
wal archive min/max (11-1): 000000010000000000000003/000000010000000000000003

full backup: 20190211-074020F
timestamp start/stop: 2019-02-11 07:40:20 / 2019-02-11 07:40:43
wal start/stop: 000000010000000000000003 / 000000010000000000000003
database size: 23.5MB, backup size: 23.5MB
repository size: 2.8MB, repository backup size: 2.8MB
</code></pre> ]]></content:encoded>
<category><![CDATA[ Production Postgres ]]></category>
<author><![CDATA[ Sarah.Conway.Schnurr@crunchydata.com (Sarah Conway Schnurr) ]]></author>
<dc:creator><![CDATA[ Sarah Conway Schnurr ]]></dc:creator>
<guid isPermalink="false">https://blog.crunchydata.com/blog/pgbackrest-performing-backups-on-a-standby-cluster</guid>
<pubDate>Wed, 27 Feb 2019 04:00:00 EST</pubDate>
<dc:date>2019-02-27T09:00:00.000Z</dc:date>
<atom:updated>2019-02-27T09:00:00.000Z</atom:updated></item></channel></rss>