Quantcast
Channel: Sanjeewa Malalgoda's Blog
Viewing all articles
Browse latest Browse all 220

Setup HAProxy Load Balancer on Ubuntu

$
0
0
01. installing haproxy on ubuntu machine
sudo apt-get install haproxy

02. Edit configurations file
sudo vi /etc/haproxy/haproxy.cfg

Add following text to file and save it

global
maxconn 4096
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
contimeout
5000
clitimeout
50000
srvtimeout
50000
listen webcluster *:80
mode http
stats enable
stats auth us3r:passw0rd
balance roundrobin
option httpchk HEAD / HTTP/1.0
option forwardfor
cookie LSW_WEB insert
option httpclose
server web01 10.100.2.85:8280 cookie LSW_WEB01 check
server web02 10.100.2.85:8281 cookie LSW_WEB02 check
03. Setting startup parameter for HAProxy set enabled as 1 to start HAproxy
sudo vi /etc/default/haproxy

# Set ENABLED to 1 if you want the init script to start haproxy.
ENABLED=1

04. Start HAProxy form command line
sudo /etc/init.d/haproxy start

05. Restart HAProxy after any configuration change form command line
sudo /etc/init.d/haproxy restart

06. Start 2 ESB servers (Set HTTP port as 8280 and 8281) and with default configurations

07. Access Web user interface from browser
Type following url in browser and provide stat credentials you provided in configurations file(haproxy.cfg)

http://10.100.2.85:80/haproxy?stats

You will see following User interface.




08. Access ESB from browser or send requests to following url
http://10.100.2.85:80/services/echo?wsdl


Following Diagram shows you how this laod balancer works.



Viewing all articles
Browse latest Browse all 220

Trending Articles