mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Support base backup targets.
pg_basebackup now has a --target=TARGET[:DETAIL] option. If specfied, it is sent to the server as the value of the TARGET option to the BASE_BACKUP command. If DETAIL is included, it is sent as the value of the new TARGET_DETAIL option to the BASE_BACKUP command. If the target is anything other than 'client', pg_basebackup assumes that it will now be the server's job to write the backup in a location somehow defined by the target, and that it therefore needs to write nothing locally. However, the server will still send messages to the client for progress reporting purposes. On the server side, we now support two additional types of backup targets. There is a 'blackhole' target, which just throws away the backup data without doing anything at all with it. Naturally, this should only be used for testing and debugging purposes, since you will not actually have a backup when it finishes running. More usefully, there is also a 'server' target, so you can now use something like 'pg_basebackup -Xnone -t server:/SOME/PATH' to write a backup to some location on the server. We can extend this to more types of targets in the future, and might even want to create an extensibility mechanism for adding new target types. Since WAL fetching is handled with separate client-side logic, it's not part of this mechanism; thus, backups with non-default targets must use -Xnone or -Xfetch. Patch by me, with a bug fix by Jeevan Ladhe. The patch set of which this is a part has also had review and/or testing from Tushar Ahuja, Suraj Kharage, Dipesh Pandit, and Mark Dilger. Discussion: http://postgr.es/m/CA+TgmoaYZbz0=Yk797aOJwkGJC-LK3iXn+wzzMx7KdwNpZhS5g@mail.gmail.com
This commit is contained in:
@ -2640,8 +2640,27 @@ The commands accepted in replication mode are:
|
||||
</para>
|
||||
|
||||
<para>
|
||||
At present, the only supported value for this parameter is
|
||||
<literal>client</literal>.
|
||||
If the target is <literal>client</literal>, the backup data is
|
||||
sent to the client. If it is <literal>server</literal>, the backup
|
||||
data is written to the server at the pathname specified by the
|
||||
<literal>TARGET_DETAIL</literal> option. If it is
|
||||
<literal>blackhole</literal>, the backup data is not sent
|
||||
anywhere; it is simply discarded.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>TARGET_DETAIL</literal> <replaceable>'detail'</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Provides additional information about the backup target.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Currently, this option can only be used when the backup target is
|
||||
<literal>server</literal>. It specifies the server directory
|
||||
to which the backup should be written.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -224,6 +224,36 @@ PostgreSQL documentation
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-t <replaceable class="parameter">target</replaceable></option></term>
|
||||
<term><option>--target=<replaceable class="parameter">target</replaceable></option></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Instructs the server where to place the base backup. The default target
|
||||
is <literal>client</literal>, which specifies that the backup should
|
||||
be sent to the machine where <application>pg_basebackup</application>
|
||||
is running. If the target is instead set to
|
||||
<literal>server:/some/path</literal>, the backup will be stored on
|
||||
the machine where the server is running in the
|
||||
<literal>/some/path</literal> directory. Storing a backup on the
|
||||
server requires superuser privileges. If the target is set to
|
||||
<literal>blackhole</literal>, the contents are discarded and not
|
||||
stored anywhere. This should only be used for testing purposes, as you
|
||||
will not end up with an actual backup.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Since WAL streaming is implemented by
|
||||
<application>pg_basebackup</application> rather than by the server,
|
||||
this option cannot be used together with <literal>-Xstream</literal>.
|
||||
Since that is the default, when this option is specified, you must also
|
||||
specify either <literal>-Xfetch</literal> or <literal>-Xnone</literal>.
|
||||
</para>
|
||||
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-T <replaceable class="parameter">olddir</replaceable>=<replaceable class="parameter">newdir</replaceable></option></term>
|
||||
<term><option>--tablespace-mapping=<replaceable class="parameter">olddir</replaceable>=<replaceable class="parameter">newdir</replaceable></option></term>
|
||||
|
Reference in New Issue
Block a user