How it works...
This recipe is simple but very powerful; it lets us leverage our other PostgreSQL replicas even if we originally intended only to use them for high availability. In this example, we will start with three PostgreSQL servers, which we can imagine to be the primary node and two standby systems.
Given that we already followed the Obtaining and installing HAProxy recipe, we already have a working HAProxy node that we can reuse for redirecting the database read traffic. This kind of dual-purpose use isn't something we could have done with a virtual IP address, especially given the load balancing we're about to enable.
Since HAProxy works in frontend/backend pairs, we begin by creating a second frontend named ft_pg_ro (for frontend, ...
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