Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9521ce4

Browse files
committed
docs: improve pg_upgrade standby instructions
This makes it clear that pg_upgrade standby upgrade instructions shouldonly be used in link mode, adds examples, and explains how rsync workswith links.Reported-by: Andreas Joseph KroghDiscussion:https://postgr.es/m/VisenaEmail.6c.c0e592c5af4ef0a2.15e785dcb61@tc7-visenaBackpatch-through: 9.5
1 parent61975d6 commit9521ce4

File tree

1 file changed

+41
-23
lines changed

1 file changed

+41
-23
lines changed

‎doc/src/sgml/ref/pgupgrade.sgml

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,12 @@ pg_upgrade.exe
423423
<para>
424424
If you have Streaming Replication (see <xref
425425
linkend="streaming-replication">) or Log-Shipping (see <xref
426-
linkend="warm-standby">) standby servers, follow these steps to
427-
upgrade them. You will not be running <application>pg_upgrade</>
428-
on the standby servers, but rather <application>rsync</> on the
429-
primary. Do not start any servers yet.
426+
linkend="warm-standby">) standby servers, and used link mode,
427+
follow these steps to upgrade them. You will not be running
428+
<application>pg_upgrade</> on the standby servers, but rather
429+
<application>rsync</> on the primary. Do not start any servers yet.
430+
If you did <emphasis>not</> use link mode, skip the instructions in
431+
this section and simply recreate the standby servers.
430432
</para>
431433

432434
<substeps>
@@ -482,40 +484,56 @@ pg_upgrade.exe
482484
<title>Run <application>rsync</></title>
483485

484486
<para>
485-
From a directory on the primary server that is above the old and
486-
new database cluster directories, run this on the
487-
<emphasis>primary</> for each standby server:
487+
When using link mode, standby servers can be quickly upgraded using
488+
<application>rsync</>. To accomplish this, from a directory on
489+
the primary server that is above the old and new database cluster
490+
directories, run this on the <emphasis>primary</> for each standby
491+
server:
488492

489493
<programlisting>
490494
rsync --archive --delete --hard-links --size-only old_pgdata new_pgdata remote_dir
491495
</programlisting>
492496

493497
where <option>old_pgdata</> and <option>new_pgdata</> are relative
494498
to the current directory on the primary, and <option>remote_dir</>
495-
is <emphasis>above</> the old and new cluster directories on
496-
the standby. Theold and new relative cluster paths
497-
must matchon the primary andstandby server. Consult the
499+
is <emphasis>above</> the old and new cluster directories
500+
onthe standby. Thedirectory structure under the specified
501+
directorieson the primary andstandbys must match. Consult the
498502
<application>rsync</> manual page for details on specifying the
499-
remote directory, e.g. <literal>standbyhost:/opt/PostgreSQL/</>.
503+
remote directory, e.g.
504+
505+
<programlisting>
506+
rsync --archive --delete --hard-links --size-only /opt/PostgreSQL/9.5/data \
507+
/opt/PostgreSQL/9.6/data standby.example.com:/opt/PostgreSQL
508+
</programlisting>
509+
500510
</para>
501511

502512
<para>
503-
What <application>rsync</> does is to copy files from the
504-
primary to the standby, and, if <application>pg_upgrade</>'s
505-
<option>--link</> mode was used, link files from the old to
506-
new clusters on the standby. It links the same files that
507-
<application>pg_upgrade</> linked in the primary old and new
508-
clusters. (Of course, linking speeds up <application>rsync</>.)
509-
Unfortunately, <application>rsync</> needlessly copies files
510-
associated with temporary and unlogged tables because these files
511-
don't normally exist on standby servers.
513+
What this does is to record the links created by
514+
<application>pg_upgrade</>'s link mode that connect files in the
515+
old and new clusters on the primary server. It then finds matching
516+
files in the standby's old cluster and creates links for them in the
517+
standby's new cluster. Files that were not linked on the primary
518+
are copied from the primary to the standby. (They are usually
519+
small.) This provides rapid standby upgrades. Unfortunately,
520+
<application>rsync</> needlessly copies files associated with
521+
temporary and unlogged tables because these files don't normally
522+
exist on standby servers.
512523
</para>
513524

514525
<para>
515526
If you have tablespaces, you will need to run a similar
516-
<application>rsync</> command for each tablespace directory. If you
517-
have relocated <filename>pg_wal</> outside the data directories,
518-
<application>rsync</> must be run on those directories too.
527+
<application>rsync</> command for each tablespace directory, e.g.:
528+
529+
<programlisting>
530+
rsync --archive --delete --hard-links --size-only /vol1/pg_tblsp/PG_9.5_201510051 \
531+
/vol1/pg_tblsp/PG_9.6_201608131 standby.example.com:/vol1/pg_tblsp
532+
</programlisting>
533+
534+
If you have relocated <filename>pg_wal</> outside the data
535+
directories, <application>rsync</> must be run on those directories
536+
too.
519537
</para>
520538
</step>
521539

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp