Enabling extreme durability

PostgreSQL 9.6 also introduces another important component to a highly available cluster of servers commonly found in the NoSQL world. Of course, we're talking about committing writes to several replicas simultaneously. Version 9.6 changes the syntax for synchronous_standby_names so that it's now possible to specify multiple standby servers as well as how many should be active at once. If we had two replicas, rep1 and rep2, and needed both to always be in sync with the primary, we would modify the parameter accordingly:

synchronous_standby_names = '2 (rep1, rep2)' 

We could also have five replicas in the list, and enable three of them, or any similar combination. Again we trade latency for better durability, but ...

Get PostgreSQL High Availability Cookbook - Second 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.