In this tutorial we will show you how to install and configuration of HAProxy on your CentOS 6 server. For those of you who didn’t know, HAProxy is a free and open-source Linux application used for load balancing network traffic. This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step by step installation of HAproxy on CentOS 6.x from source.
Install and Configure HAproxy on CentOS 6
Step 1. First add yum repository your system.
HAProxy isn’t available in the default repositories for CentOS. In order for us to be able to install it, we need to either compile it from source (preferred) or add the EPEL repository to our server and install it using Yum.
#CentOS 6 – 32-bit
#CentOS 6 – 64-bit
We have to modify the configuraion file of haproxy i.e. /etc/haproxy/haproxy.cfg as per our requirement. (Change this configuration as your network requirements). For more configuration details check this url.
#nano /etc/haproxy/haproxy.cfg global
maxconn45000# Total Max Connections. This is dependent on ulimit
# Configuration for HTTP site
balanceroundrobin# Load Balancing algorithm
# Configuration for HTTPS site listen
balancesource# Load Balancing algorithm
Step 5. Now you will able to browse your applicaiton using the IP of the haproxy server. For haproxy Status dashboard you have to browse the URL: http://192.168.2.102:31337. It will ask you for the username and password. Use the username and password you defined on the configuraion file as “stats auth”.
Congratulation’s! You have successfully installed HAProxy. Thanks for using this tutorial for installing HAProxy on CentOS 6 system. For additional help or useful information, we recommend you to check the official HAProxy web site.