Pound : HTTP Load Balancing2016/06/07 |
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. |
root@dlp:~# apt-get -y install pound
|
[2] | Configure Pound. |
root@dlp:~# mv /etc/pound/pound.cfg /etc/pound/pound.cfg.org
root@dlp:~#
vi /etc/pound/pound.cfg User "www-data" Group "www-data" # log level (max: 5) LogLevel 3 # specify LogFacility LogFacility local1 # interval of heartbeat - seconds Alive 30 Control "/var/run/pound/poundctl.socket" # 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 of 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 sed -i -e "s/^startup=0/startup=1/" /etc/default/pound root@dlp:~# systemctl restart pound |
[3] | Change Rsyslog setting to revord logs from Pound. |
root@dlp:~#
vi /etc/rsyslog.d/50-default.conf # line 9: change and add like follows *.*;auth,authpriv.none;local1.none -/var/log/syslog local1.* /var/log/pound.logroot@dlp:~# systemctl restart rsyslog |
[4] | Change Apache2 settings on Backend Web servers to record logs of X-Forwarded-For. |
root@www01:~# a2enmod remoteip Enabling module remoteip. To activate the new configuration, you need to run: service apache2 restart
root@www01:~#
vi /etc/apache2/apache2.conf # line 206-209: change like follows # specify Pound server's IP address for RemoteIPInternalProxy
RemoteIPHeader X-Forwarded-For RemoteIPInternalProxy 10.0.0.30 LogFormat "%v:%p %a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combinedLogFormat " %a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
systemctl restart apache2 |
[5] | Make sure it works fine to access to the frontend server from a Client with HTTP like follows. |
Sponsored Link |