How it works...
Promoting an asynchronous standby server to synchronous mode is actually a fairly simple procedure. We begin by modifying the primary_conninfo setting in the standby's postgresql.conf (12+) or recovery.conf file to include the application_name value. PostgreSQL differentiates replicas by their stated application name, so if we change this, we can specifically target that particular replica. Any other synchronous standby nodes should be assigned different names.
Once we restart the PostgreSQL server on the streaming standby, it will reconnect to the primary server with the new application_name value that we assigned. From this point onward, we can refer to the standby server as pgha2. Hence, when we alter the 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