Synchronous replication
Streaming replication is asynchronous by default. This means that if a user commits a transaction on the master, it gets the confirmation of the commit immediately, and the replication will happen only afterward. In case the master crashes right after a commit and the WAL records were not sent yet, the data will be lost, although the user has seen the commit was successful.
When high availability is a requirement in the sense that no data loss is acceptable, streaming replication can be set to synchronous mode.
To enable it on the master, in the postgresql.conf file, the synchronous_standby_names configuration parameter should be set to the name that identifies the standby server, for example, synchronous_standby_names ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access