HAProxy can be used to load balance the connections or even route the connections to a specific host that passes a check. This check can be performed using Xinetd (Extended Internet Service Daemon). The Xinetd daemon can listen to requests on any custom port. It executes custom logic to serve the request. We could then send unique status codes based on the server to which it has connected. For example, if the server is the primary, the status code should be 200. If the server is a standby, the status code can be 300.
In this recipe, we shall see how HAProxy can rely on xinetd for transparent application failover.
Getting ready...
Performing checks using xinetd may be time-consuming if a connection could not be established to a database server while performing the checks. This needs to be well tested before implementing it in production.
How to do it...
The following are the steps to enable consistency checks using xinetd:
- Create a script...