Ok let go to the point...
1. Install HAProxy into Ubuntu Server.
# apt-get install haproxy
2. Change the HAProxy configuration.
global
log
127.0.0.1 daemon debug
#log
127.0.0.1 local0
#log
127.0.0.1 local1 notice
#log
loghost local0 info
stats socket
/tmp/stats
maxconn 4096
pidfile
/var/run/haproxy.pid
#chroot
/usr/share/haproxy
#user haproxy
#group haproxy
daemon
#debug
#quiet
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 3000
contimeout 5000
clitimeout 50000
srvtimeout 50000
listen webcluster
*:80
mode http
stats enable
stats uri
/stats //default using http://web.domain.com/haproxy?stats
stats auth
admin:p@ssw0rd
balance
roundrobin
option httpchk
HEAD / HTTP/1.0
option
forwardfor
cookie LSW_WEB
insert
option
httpclose
server 192.18.250.22 192.18.250.22:80 check inter
5000 fastinter 1000 fall 1 weight 1
#server web1 192.18.250.22:80
weight 1 fastinter 5000 rise 2 fall 3
server 192.18.250.23 192.18.250.23:80 check inter
5000 fastinter 1000 fall 1 weight 1
#server web2 192.18.250.23:80
weight 1 fastinter 5000 rise 2 fall 3
option httpclose # disable keep-alive
option checkcache # block response if set-cookie
& cacheable
rspidel
^Set-cookie:\ IP= # do not let this
cookie tell our internal IP address
#errorloc 502
http://192.168.114.58/error502.html
#errorfile 503 /etc/haproxy/errors/503.http
errorfile 400
/etc/haproxy/errors/400.http
errorfile 403
/etc/haproxy/errors/403.http
errorfile 408
/etc/haproxy/errors/408.http
errorfile 500
/etc/haproxy/errors/500.http
errorfile 502
/etc/haproxy/errors/502.http
errorfile 503
/etc/haproxy/errors/503.http
errorfile 504
/etc/haproxy/errors/504.http
3. Setting startup parameter for HAProxy set enabled as 1 to start HAproxy
# nano /etc/default/haproxy
# /etc/init.d/haproxy start
http://web.domain.com/stats
No comments:
Post a Comment