HAProxy is an excellent load balancer which performs extremely well. This page explains how to install HAProxy 1.3.15.2 since this is one of the recommended versions on the ”HAProxy Mailing List”:
Server response time discrepancy
Also, it has been recommended on that thread to use one of the following kernels:
- 2.6.22
- 2.6.25
- 2.6.18
Installation Steps
First, install some required tools/packages:
apt-get update apt-get install build-essential make libpcre3 libpcre3-dev
If you want to stick to one of the recommended kernels, at the time this how-to was written, Debian Etch standard apt-get repositories include the kernel 2.6.18, which could be installed (optional):
apt-get install linux-kernel-headers
Then you should reboot after, to start using this new kernel.
If you want to find out which kernel you are using, you may want to run this:
uname -rs
The output should be something like this:
Linux 2.6.18-6-686
Now, you should configure syslog daemon to listen following this document:
Configuring syslog to receive messages from the network (aka listen)
Check the HAProxy’s README file, and make sure:
To build haproxy, you will need :
- GNU make. Neither Solaris nor OpenBSD’s make work with this makefile. However, specific Makefiles for BSD and OSX are provided.
- GCC between 2.91 and 4.3. Others may work, but not tested.
- GNU ld
Proceed with the compilation as follows (note that I have used TARGET, CPU and USE_PCRE. These options need to be double checked on the readme file, it is very clear):
cd /opt/ wget http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.15.2.tar.gz tar zxvf haproxy-1.3.15.2.tar.gz # # Double check your options on the readme file first!!!! # http://sysbible.org/att/HAProxy-1.3.15_README.txt # cd /opt/haproxy-1.3.15.2 make TARGET=linux26 CPU=i686 USE_PCRE=1 make install ln -s /usr/local/sbin/haproxy /usr/sbin/haproxy
Now you should be ready to go:
haproxy HA-Proxy version 1.3.15.2 2008/06/21 Copyright 2000-2008 Willy Tarreau Usage : haproxy -f [ -vdVD ] [ -n ] [ -N ] [ -p ] [ -m ] -v displays version ; -vv shows known build options. -d enters debug mode ; -db only disables background mode. -V enters verbose mode (disables quiet mode) -D goes daemon ; implies -q -q quiet mode : don't display messages -c check mode : only check config file and exit -n sets the maximum total # of connections (2000) -m limits the usable amount of memory (in MB) -N sets the default, per-proxy maximum # of connections (2000) -p writes pids of all children to this file -de disables epoll() usage even when available -ds disables speculative epoll() usage even when available -dp disables poll() usage even when available -sf/-st [pid ]* finishes/terminates old pids. Must be last arguments.
haproxy -vv HA-Proxy version 1.3.15.2 2008/06/21 Copyright 2000-2008 Willy Tarreau Build options : TARGET = linux26 CPU = i686 CC = gcc CFLAGS = -O2 -march=i686 -g OPTIONS = USE_PCRE=1