What is HAProxy :
HAProxy is a very fast and reliable solution for high availability, load balancing. It supports TCP and HTTP-based applications. Now a days all website need 99.9% of up-time required for their site. It's not possible with single server setup. So we need high availability environment which can easily manage single server failure.
Installation of HAProxy
Installation of HAProxy is very easy follow the simple step to install
yum install haproxy -y
that's all only you need internet access. After that we have configure not configure just add some lines to the haproxy configuration file and need to start the service.
Configurations of HAProxy
Main configuration file is in /etc/haproxy/haproxy.cfg, in that we need to add some details that we need to access. Follow the steps below.
add the below mentioned line in EOD
vi /etc/haproxy/haproxy.cfg
add below lines
######### Configure frondend Server ################
frontend webapp
bind *:80
default_backend webserver
######### Configure Backend Server #################
backend webserver
balance roundrobin
server web1 10.0.0.11:80 check
server web1 10.0.0.12:80 check
server web1 10.0.0.13:80 check
server web1 10.0.0.14:80 check
Save & Exit
start the haproxy service and enable it for start when booting
In RHEL 6
service haproxy start
chkconfig haproxy on
In RHEL 7
systemctl start haproxy
systemctl enable haproxy
Note :
if your http service is running in 80 change it to other port. It will cause starting issue in haproxy.
Now try in web browser it will work.
HAProxy is a very fast and reliable solution for high availability, load balancing. It supports TCP and HTTP-based applications. Now a days all website need 99.9% of up-time required for their site. It's not possible with single server setup. So we need high availability environment which can easily manage single server failure.
Installation of HAProxy
Installation of HAProxy is very easy follow the simple step to install
yum install haproxy -y
that's all only you need internet access. After that we have configure not configure just add some lines to the haproxy configuration file and need to start the service.
Configurations of HAProxy
Main configuration file is in /etc/haproxy/haproxy.cfg, in that we need to add some details that we need to access. Follow the steps below.
add the below mentioned line in EOD
vi /etc/haproxy/haproxy.cfg
add below lines
######### Configure frondend Server ################
frontend webapp
bind *:80
default_backend webserver
backend webserver
balance roundrobin
server web1 10.0.0.11:80 check
server web1 10.0.0.12:80 check
server web1 10.0.0.13:80 check
server web1 10.0.0.14:80 check
Save & Exit
start the haproxy service and enable it for start when booting
In RHEL 6
service haproxy start
chkconfig haproxy on
In RHEL 7
systemctl start haproxy
systemctl enable haproxy
Note :
if your http service is running in 80 change it to other port. It will cause starting issue in haproxy.
Now try in web browser it will work.