Skip to content

Commit 8366c78

Browse files
Allow pg_basebackup from standby node with safety checking.
Base backup follows recommended procedure, plus goes to great lengths to ensure that partial page writes are avoided. Jun Ishizuka and Fujii Masao, with minor modifications
1 parent 74ab96a commit 8366c78

File tree

11 files changed

+501
-44
lines changed

11 files changed

+501
-44
lines changed

doc/src/sgml/ref/pg_basebackup.sgml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,48 @@ PostgreSQL documentation
6464
better from a performance point of view to take only one backup, and copy
6565
the result.
6666
</para>
67+
68+
<para>
69+
<application>pg_basebackup</application> can make a base backup from
70+
not only the master but also the standby. To take a backup from the standby,
71+
set up the standby so that it can accept replication connections (that is, set
72+
<varname>max_wal_senders</> and <xref linkend="guc-hot-standby">,
73+
and configure <link linkend="auth-pg-hba-conf">host-based authentication</link>).
74+
You will also need to enable <xref linkend="guc-full-page-writes"> on the master.
75+
</para>
76+
77+
<para>
78+
Note that there are some limitations in an online backup from the standby:
79+
80+
<itemizedlist>
81+
<listitem>
82+
<para>
83+
The backup history file is not created in the database cluster backed up.
84+
</para>
85+
</listitem>
86+
<listitem>
87+
<para>
88+
There is no guarantee that all WAL files required for the backup are archived
89+
at the end of backup. If you are planning to use the backup for an archive
90+
recovery and want to ensure that all required files are available at that moment,
91+
you need to include them into the backup by using <literal>-x</> option.
92+
</para>
93+
</listitem>
94+
<listitem>
95+
<para>
96+
If the standby is promoted to the master during online backup, the backup fails.
97+
</para>
98+
</listitem>
99+
<listitem>
100+
<para>
101+
All WAL records required for the backup must contain sufficient full-page writes,
102+
which requires you to enable <varname>full_page_writes</> on the master and
103+
not to use the tool like <application>pg_compresslog</> as
104+
<varname>archive_command</> to remove full-page writes from WAL files.
105+
</para>
106+
</listitem>
107+
</itemizedlist>
108+
</para>
67109
</refsect1>
68110

69111
<refsect1>

0 commit comments

Comments
 (0)