Skip to content

10 Multiple Synchronous Standby Servers

Source chapter 3.8 for PostgreSQL 9.6.
Beta 1Source pages: PDF 49Original PDF on GitHub

PDF page 49

Support synchronous replication with multiple synchronous standby servers. Specify the number of instances to execute synchronous replication to the parameter synchronous_standby_names in primary instance. Syntax

synchronous_standby_names = num_sync (application_name, application_name, …)

Specify the number of instances to execute synchronous replication to the num_sync in integer of 1 or more. If specified zero or less , if omitted, the instance can’t start. If the specified number of instances cannot be ensured, update transaction of the primary instance is stopped. In the example below, there are three instances that can execute synchronous replication, and execute synchronous replication to two instance actually.

Example 46 Multiple synchronous standby server replication
postgres=> SHOW synchronous_standby_names ;
    synchronous_standby_names
----------------------------------
 2 (standby1, standby2, standby3)
(1 row)
postgres=> SELECT application_name, sync_state FROM pg_stat_replication ;
 application_name | sync_state
------------------+------------
 standby1         | sync
 standby2         | sync
 standby3         | potential
(3 rows)
The parameter synchronous_standby_names can be written in the same format as the previous
version. In that case instance that can execute synchronous replication is one.