Linux How to..

Linux How to ,Share Knowledge

HA Proxy with session support

May-25-2015 By admin

TAG : how to install HA Proxy with session support

 


example  :  HA Proxy user internet  access to http://10.1.228.137/  round robin to Web1 and Web2  with web server  session support

โค๊ด: [Select]

HAProxy: 10.1.228.137 port 80

Web1 : 10.1.228.52 port 80

Web2 : 10.1.228.53 port 80
install haproxy
wget http://blog.up2box.com/downloads/haproxy-1.4.20.tar.gz
Compile the sources with `make install`
#tar -zxvf  haproxy-1.4.20.tar.gz

#cd haproxy-1.4.20

#make install

#cp haproxy /usr/sbin/haproxy

+Download a sample config file
#wget http://blog.up2box.com/downloads/haproxy-standard.cfg -O /etc/haproxy.cfg
+Download a launcher
#wget http://blog.up2box.com/downloads/haproxy.init -O /etc/init.d/haproxy
+adjust the startup settings
#chmod +x /etc/init.d/haproxy
#chkconfig –add haproxy
#chkconfig haproxy on

vim /etc/haproxy.cfg

input line below :

โค๊ด: [Select]

listen webfarm 10.1.228.137:80
mode http
balance source
cookie JSESSIONID prefix
option httpchk HEAD /check.txt HTTP/1.0
option httpclose
option forwardfor
server web1 10.1.228.52:80 cookie A check
server web2 10.1.228.53:80 cookie B check
installed success

 

 

 

Comments are closed.