How to do it...

Make sure you have set the application_name on each standby node. Decide the order of servers to be listed in the synchronous_standby_names parameter. Note that the standbys named must be directly attached standby nodes or else their names will be ignored. Synchronous replication is not possible for cascaded nodes, though cascaded standbys may be connected downstream. An example for a simple four node config of nodeA (master), nodeB, nodeC, and nodeD (standbys) would be set on nodeA as follows:

synchronous_standby_names = 'nodeB, nodeC, nodeD'

If you want to receive replies from at least two of the nodes then we would specify this using the following special syntax in PostgreSQL 9.6:

synchronous_standby_names = '2 (nodeB, ...

Get PostgreSQL Administration Cookbook, 9.5/9.6 Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.