Forum Discussion

Z_haseeb's avatar
Z_haseeb
Icon for Nimbostratus rankNimbostratus
Dec 10, 2022

HAproxy vs F5

We have a environment of HAproxy for Postgres cluster. Postgres cluster works with the help of Patroni and other services. Patroni help HAproxy to let him know about Active Postgres node thru API. My query is, Can we use F5 load balancer instead HAproxy?

2 Replies

  • Dear Mohamed_Ahmed_Kansoh we have an environment configured with 2 kong applications nodes, 3 patroni nodes, 3 etcd nodes and 3 postgresql nodes. We have also placed a HAproxy node between kong applications & postgresql and everything is working 100% fine. My query is. we only need to replace the haproxy with F5 or any enterprise level load balancer.

    MORE DETAILS FOR HAPROXY

    KONG is a two tier product. KONG Application & KONG database. KONG application connect with KONG database thru HAPROXY load balancer in case there is a need to HA the KONG product. In our environment we have two KONG applications and two database machines.

    Suppose both KONG Applications send requests to HAPROXY load balancer on port 5000 and then load balancer forward that request to KONG database (Active node) on port 5432.

    Now you may have a question that how the HAPROXY load balancer recognize the Active database node so that the load balancer forward the request on to port 5432. Below is the way to understand

    please note, 8121 is a rest api port listening on both database machines. In our case please consider NODE-Y and NODE-Z are database machines
    - If any node from NODE-Y, NODE-Z is running as a Active Database, the machine will respond to Load Balancer on request 'GET /' with http status code 200,
    - If any node from NODE-Y, NODE-Z is running as a Replica/Slave Database, the machine will respond to Load Balancer on request 'GET /' with http status code 503.

    So when the HAPROXY Load Balancer receive status code 200 from any 10.10.64.11 OR 10.10.64.12 machine from port 8121, the Load Balancer will forward all inbound requests(received on Load Balancer port 5000) to 5432 port on that machine who return status code 200