Friday, February 22, 2008

Linux TCP load balancing


Maybe some of us need to balance TCP connection through several server. This is a simple way to do so.

1. Download the package
wget http://www.inlab.de/balance-3.40.tar.gz
2. Extract, compile and install:
tar zxvf balance-3.40.tar.gz
cd balance-3.40
vi Makefile
Change this line of code: MANDIR=${BINDIR}/../man/man1
For Ubuntu users : MANDIR=/usr/share/man/man1
For RedHat users: MANDIR=/usr/local/share/man/man1
make
make install
3 Using the load balancer
Here is the network topology used


balance -f http 192.168.0.1 192.168.0.2 192.168.0.3
For http that requires http session we can use
balance -f http 192.168.0.1 192.168.0.2 192.168.0.3 %

We can also use this balancer to balance another tcp traffic such as ftp, etc

This article is taken from linux2.arinet.org

No comments: