Wednesday 8 February 2017

High Availability Configuration and LoadBalancing for webservers using HAProxy::

High Availability  Configuration and LoadBalancing for webservers using HAProxy::
=============================================================
My scenario is as follows:

HA Proxy is installed on 192.168.1.100

I have one application hosted on four Tomcat instances as follows sharing the same database.
192.168.1.10:8084
192.168.1.10:8085
192.168.1.10:8086
192.168.1.10:8087

Database server 192.168.1.50

I have four Apache instances installed on another server which is connected to the tomcat instances mentioned above using mod_jk connector

192.168.1.20:8040 --> 192.168.1.10:8084
192.168.1.20:8050 --> 192.168.1.10:8085
192.168.1.20:8060 --> 192.168.1.10:8086
192.168.1.20:8070 --> 192.168.1.10:8087

So once configured, when I browse  192.168.1.100, I should get the any of the four tomcat pages

Please check the previous thread for apache-mod_jk configurations


HAproxy installation steps:-
# yum install haproxy

Edit /etc/haproxy/haproxy.cfg and add the frontend and backend entries at the bottom of the file.

Comment off any default entries.
========================

frontend http-service
    bind 192.168.1.100:80
    acl url path_beg /
    default_backend http-server
    mode http

backend http-server
    balance roundrobin
    option httpchk HEAD /
    server service1 192.168.1.20:8040 check
    server service2 192.168.1.20:8050 check
    server service3 192.168.1.20:8060 check
    server service4 192.168.1.20:8070 check

===========================
Disable  SELinux and  Restart the service.

No comments:

Post a Comment