CentOS Stream 8
Sponsored Link

Pound : HTTP Load Balancing2021/03/17

 
Install Pound which is the 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
+----------+-----------+   +-----------+----------+   +-----------+----------+
|   [ dlp.srv.world ]  |   | [ node01.srv.world ] |   | [ node02.srv.world ] |
|         Pound        |   |      Web Server#1    |   |      Web Server#2    |
+----------------------+   +----------------------+   +----------------------+

 
Configure Pound to load balance to Web Server#1, Web Server#2.
[1] Install Pound.
# install from EPEL

[root@dlp ~]#
dnf --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 (available value is 1-9, max 9)
        Priority 5
    End

    BackEnd
        Address  10.0.0.52
        Port     80
        Priority 5
    End
End

[root@dlp ~]#
systemctl enable --now pound

[3] If Firewalld is running, allow Pound service port.
[root@dlp ~]#
firewall-cmd --add-service=http --permanent

success
[root@dlp ~]#
firewall-cmd --reload

success
[4] Change Rsyslog setting to separate logs from Pound.
[root@dlp ~]#
vi /etc/rsyslog.conf
# line 46 : 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

[5] Change settings on Backends Web server (Apache httpd on this example) to logging X-Forwarded-For header.
[root@node01 ~]#
vi /etc/httpd/conf/httpd.conf
# line 199 : change like follows

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

[6] Verify working normally to access to frontend Pound Server.
Matched Content