CentOS 7
Sponsored Link

Pound : HTTP Load Balancing2015/06/09

 
Install Pound which is HTTP/HTTPS Load Balancing software.
This example is based on the environment like follows.
        |
--------+--------------------------------------------------------------------
        |
        +-------------------+--------------------+--------------------+
        |10.0.0.30          |10.0.0.51           |10.0.0.52           |10.0.0.53
 +------+-----+     +-------+------+     +-------+------+     +-------+------+
 |  Frontend  |     |   Backend#1  |     |   Backend#2  |     |   Backend#3  |
 |   Pound    |     |  Web Server  |     |  Web Server  |     |  Web Server  |
 +------------+     +--------------+     +--------------+     +--------------+

 
Configure Pound to load balance to Backend#1, Backend#2, Backend#3 web servers.
[1] Install Pound.
# install from EPEL

[root@dlp ~]#
yum --enablerepo=epel -y install Pound
[2] Configure Pound.
[root@dlp ~]#
mv /etc/pound.cfg /etc/pound.cfg.org

[root@dlp ~]#
vi /etc/pound.cfg
User "pound"
Group "pound"
# log level (max: 5)

LogLevel 3
# specify LogFacility

LogFacility local1
# interval of heartbeat - seconds

Alive 30

# define frontend

ListenHTTP
    Address 0.0.0.0
    Port 80
End

# define backend

Service
    BackEnd
       # backend server's IP address

        Address  10.0.0.51
       # backend server's port

        Port     80
       # set priority (value is 1-9, max 9)

        Priority 5
    End

    BackEnd
        Address  10.0.0.52
        Port     80
        Priority 5
    End

    BackEnd
        Address  10.0.0.53
        Port     80
        Priority 5
    End
End

[root@dlp ~]#
sed -i -e "s/^PIDFile/#PIDFile/" /usr/lib/systemd/system/pound.service

[root@dlp ~]#
systemctl start pound

[root@dlp ~]#
systemctl enable pound

[3] Change Rsyslog setting to revord logs from Pound.
[root@dlp ~]#
vi /etc/rsyslog.conf
# line 54: change like follows

*.info;mail.none;authpriv.none;cron.none
,local1.none
  /var/log/messages
local1.*                                                /var/log/pound.log

[root@dlp ~]#
systemctl restart rsyslog

[4] Change httpd settings on Backend Web servers to record logs of X-Forwarded-For.
[root@www ~]#
vi /etc/httpd/conf/httpd.conf
# line 196: change

LogFormat "
\"%{X-Forwarded-For}i\"
%l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
[root@www ~]#
systemctl restart httpd

[5] Make sure all works fine to access to the frontend server from a Client with HTTP like follows.
Matched Content