HAProxy Enterprise Documentation 1.7r2

PostgreSQL Health Checks

HAProxy Enterprise can perform a simple PostgreSQL check by sending a StartupMessage. The check is valid if the server responds with a successful Authentication request message rather than an error response. Add the option pgsql-check directive to your backend section and include a check parameter on each server line.

backend be_pgsql
   option pgsql-check
   server srv1 10.0.0.1:5432 check
   server srv2 10.0.0.2:5432 check

Optionally, include the username that will be used to connect to the PostgreSQL server:

backend be_pgsql
   option pgsql-check hapee-lb
   server srv1 10.0.0.1:5432 check
   server srv2 10.0.0.2:5432 check

Next up

Redis Health Checks