Setup HAProxy on CentOS !!!
HAProxy stands for High Availability Proxy, for the High Performance TCP/HTTP load balancing.
Installation Steps :
# yum -y install wget gcc gcc-c++ autoconf automake make
# wget http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.20.tar.gz /download
# tar -zxf haproxy-1.4.20.tar.gz
# cd haproxy-1.4.20
# make TARGET=centos
# cp haproxy /usr/sbin/haproxy
Now take configuration files :
# wget http://layer1.rack911.com/haproxy/haproxy-standard.cfg -O /etc/haproxy.cfg
# wget http://layer1.rack911.com/haproxy/haproxy.init -O /etc/init.d/haproxy
================================================
Sample /etc/haproxy.conf file:
global
maxconn 4096
pidfile /var/run/haproxy.pid
daemon
defaults
mode http
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
listen server0 192.168.1.1:80
mode http
balance roundrobin
server server1 192.168.1.2:80 check ( Replace with your public IPs)
server server2 192.168.1.3:80 check
================================================
Start the load balancer now
Note : Just make sure you have set a proper data syncronization between your two web-servers
Installation Steps :
# yum -y install wget gcc gcc-c++ autoconf automake make
# wget http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.20.tar.gz /download
# tar -zxf haproxy-1.4.20.tar.gz
# cd haproxy-1.4.20
# make TARGET=centos
# cp haproxy /usr/sbin/haproxy
Now take configuration files :
# wget http://layer1.rack911.com/haproxy/haproxy-standard.cfg -O /etc/haproxy.cfg
# wget http://layer1.rack911.com/haproxy/haproxy.init -O /etc/init.d/haproxy
================================================
Sample /etc/haproxy.conf file:
global
maxconn 4096
pidfile /var/run/haproxy.pid
daemon
defaults
mode http
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
listen server0 192.168.1.1:80
mode http
balance roundrobin
server server1 192.168.1.2:80 check ( Replace with your public IPs)
server server2 192.168.1.3:80 check
================================================
Start the load balancer now
Note : Just make sure you have set a proper data syncronization between your two web-servers
Commentaires
Enregistrer un commentaire