@@ -423,10 +423,12 @@ pg_upgrade.exe
423
423
<para>
424
424
If you have Streaming Replication (see <xref
425
425
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.
430
432
</para>
431
433
432
434
<substeps>
@@ -482,40 +484,56 @@ pg_upgrade.exe
482
484
<title>Run <application>rsync</></title>
483
485
484
486
<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:
488
492
489
493
<programlisting>
490
494
rsync --archive --delete --hard-links --size-only old_pgdata new_pgdata remote_dir
491
495
</programlisting>
492
496
493
497
where <option>old_pgdata</> and <option>new_pgdata</> are relative
494
498
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. The old and new relative cluster paths
497
- must match on the primary and standby server . Consult the
499
+ is <emphasis>above</> the old and new cluster directories
500
+ on the standby. The directory structure under the specified
501
+ directories on the primary and standbys must match . Consult the
498
502
<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
+
500
510
</para>
501
511
502
512
<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.
512
523
</para>
513
524
514
525
<para>
515
526
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_xlog</> 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_xlog</> outside the data
535
+ directories, <application>rsync</> must be run on those directories
536
+ too.
519
537
</para>
520
538
</step>
521
539
0 commit comments