Load balancing is the method of distributing the requests that came from the clients to the multiple internal servers, those servers serves the same content to the clients. Load balancing widely used with the web server where the web content served by multiple internal server to the clients via main public server. The main public server acts as proxy for Apache server to serve the web content, main public server must have load balancer package installed on it.Pound is one of the package that help you to setup the load balancer for the web server, it provides reverse proxy and also supports HTTPS requests. It works like below.
1. When the clients request the web content over the internet, requests goes to the Pound Gateway ( Public Main Server) 18.104.22.168 at port no 80 or 443.
2. Pound gateway already configured with the internal servers (192.168.0.151 and 192.168.0.152)
3. Pound gateway forwards all the queries to the internal servers port no 80 or 443.
4. Pound gateway will do reverse proxy to deliver web content back to clients.
Install Web Server:
Install Apache server on both internal server using the yum command.
# yum install httpd
Place test index.html under /var/www/html on internal servers.
# echo "This is 192.168.0.151" > /var/www/html/index.html
# echo "This is 192.168.0.152" > /var/www/html/index.html
Restart the Apache server.
Verify the web servers by visiting http://192.168.0.151 and http://192.168.0.152; it should show “This is 192.168.0.151” and “This is 192.168.0.152” respectively
Pound does not bundle with the CentOS or Red Hat package, so you need to setup the extra repository package.
Download the EPEL repository rpm.
# rpm -Uvh http://kartolo.sby.datautama.net.id/EPEL/6/i386/epel-release-6-8.noarch.rpm
Install Pound rpm.
# yum install Pound
pound.cfg is the configuration file and can be found inside /etc directory, open up the configuration file to distribute the requests between the internal servers. You can also use HTTPS requests to distribute between the servers, if you don’t have SSL installed put Address 0.0.0.0 on ListenHTTPS field.
Modify the configuration file.
ListenHTTPAddress 22.214.171.124 Port 80 End ListenHTTPS Address 126.96.36.199Port 443 Cert "/etc/pki/tls/certs/pound.pem" End Service BackEnd Address 192.168.0.151 Port 80 End BackEnd Address 192.168.0.152 Port 80 End End
Now visit http://188.8.131.52, refresh the page continuously. You could the see the home page of internal web server, at the same time you can notice that home page continuously changes on every request.
For Example, if you want to use Pound Gateway as one of the internal web server (184.108.40.206); make Apache web server to listen on some other port instead of port 80, because Pound uses port 80. Below is the small configuration to act as both ( Pound gateway and Web Server). Pound listens on Port 80 at the same time Apache listens on Port 808.
ListenHTTPAddress 220.127.116.11 Port 80 End ListenHTTPS Address 18.104.22.168Port 443 Cert "/etc/pki/tls/certs/pound.pem" End Service BackEnd Address 22.214.171.124 Port 808 End BackEnd Address 192.168.0.152 Port 80 End End
Load balancer is the most important solution in enterprise environment where the sever gets million’s of request, it ensures the client to get the web content on time and also free up the load on servers.
Image taken from YouTube Channel NetworkNutsDotNet
Apache load balancing,Apache Load Balancing CentOS, Apache Load balancing RHEL, Apache Load Balancing RHEL 6, Apache Load balancing CentOS 6, Apache Load Balancing Linux, Web Server Load Balancing Linux, Web Server load balancing,Web Server Load Balancing CentOS, Web Server Load balancing RHEL, Web Server Load Balancing RHEL 6, Web Server Load balancing CentOS 6, Web Server Load Balancing Linux, load balancing, Load Balancing CentOS, Load balancing RHEL, Load Balancing RHEL 6, Load balancing CentOS 6, Load Balancing Linux,