In this chapter, we have seen how pgBouncer can be used for the purpose of connection pooling and HAProxy for the purpose of load balancing. We have also discussed how xinetd can be used to perform a seamless application failover. However, to build a robust high-availability architecture, we could combine pgBouncer and HAProxy with Patroni as seen in the following diagram:
We have already discussed Patroni and how it helps in performing an automatic failover in Chapter 5, High Availability and Automatic Failover. In this recipe, we shall see the high-level architecture involved in achieving the best HA setup using a combination of three majorly used open source tools.
Getting ready...
In order to proceed further with this recipe, you must have already set up a Patroni cluster using the recipes discussed in Chapter 5, High Availability and Automatic Failover.
How to do it...
Patroni exposes REST APIs to let external applications...