The goal of this recipe is to observe how quickly PgBouncer will switch from one server to another. HAProxy handles most of this work already, but PgBouncer has its own series of checks and safeguards that could artificially increase the failover time necessary to reassign server connections.
So the first thing we want to do is observe the process in action using the default settings. If we start an endless loop that simply reports the IP address of the server we're contacting, we accomplish two goals. The first is that we connect as quickly as possible to PgBouncer so that we have a timeline, and we also learn the IP address of the current BDR server, which should correspond to pgha1 or pgha2.
Then we will want a connection ...