Archive for the 'Load Balancer' Category

install and configure haproxy, the software based loadbalancer in Ubuntu

HAProxy is a very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It’s free and open source application which is very lightweight as well. I checked few other alternatives like perlbal, pond etc. but found haproxy most competent performer.

I’m describing here the steps I followed to download, install and configure it in Ubuntu Server. We have 2 backend Web servers which will receive traffic from Load balancer host running HAProxy in front of them.

Step 1. Download, compile and install HAproxy from here :

$ cd /usr/src
$ wget http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.11.tar.gz
$ tar xzf haproxy-1.4.11.tar.gz 
$ cd haproxy-1.4.11
$ make install

Enable or fix logging for HAProxy load balancer

After configuration of HAProxy to balance web traffic, I’ve noticed that HAProxy is not generating any logs in my server. Due to its load balancer role, logging is vital to diagnose any issue that might come in future.

In its default config, HAProxy send logs to a syslog facility: local0, via a socket connection. By default, your syslog configuration probably doesn’t accept socket connections, and even doesn’t have a local0 facility, so you have no HAProxy log. If you want it, configure syslog to accept TCP connections by adding -r to syslogd parameters.

How to Install, setup and config HAProxy loadbalancer for content switching

First here is the guide I have written to install and configure HAproxy. Next, Sometimes we have different servers with different contents, such as one set of servers with all static contents (html, image files) of a website while another set of servers have dynamic contents (cgi, perl, php scripts) This type of config is beneficial in some situations where you want to serve your static data directly from CDN for faster response and dynamic contents from your own servers.

Download, install and configure perlbal to load balance web server

Perlbal is fast and efficient web server, reverse proxy(load balancer). Here are quick steps to get started with it. I have tested perlbal-1.60 on my CentOS 5 box. There are many other possible ways to do the same and the way which worked for me, may not work for you.

Step 1. Download perlbal OR install it via perl cpan, like this:

$ perl -MCPAN -e shell
cpan-> install perlbal

Step 2. Find out its sample config (/root/.cpan/build/Perlbal-1.60/doc/config-guide.txt) or if you downloaded and compiled it, file will be there. Put this file in /etc/perlbal as perlbal.conf.

$ mkdir /etc/perlbal
$ cp /root/.cpan/build/Perlbal-1.60/doc/config-guide.txt /etc/perlbal/perlbal.conf
Get Adobe Flash playerPlugin by wpburn.com wordpress themes