In Chapter 1, Architectural Considerations, we included a recipe on Introducing Indirection. One of the simplest methods for attaining indirect access to our data is by assigning a virtual network address to whichever server hosts our current primary PostgreSQL node.
Therefore, whenever a standby node is promoted to primary status, we can move the network address to the new server. No applications need to be reconfigured, no connections must be changed, and all connections are routed to the writable node in our cluster.
Another semi-popular method is to change the Domain Name System (DNS) to redirect network connections to the new server. The beauty of this technique is that it fully insulates the entire access path so that the reorganization of the entire network can include IP addresses. The main drawback of this approach is that DNS changes...