Load Balancers are effectively used to distribute incoming traffic across the application servers, among a pool of servers. If one of those servers goes down, the load balancer will redirect the traffic to the others, assuring that the services continue to be available. The load balancer also allows you to add additional resources to handle a temporary traffic spike or a more consistent increase in demand. By placing a load balancer between visitors and the backend you can make changes to the backend without exposing your visitors to those changes.



  • One cloud server to be used as the load balancer
  • Two cloud servers to be used as web servers

For all three servers,

  • Install Apache HTTP server on load balancer, Web Server 1 and Web Server 2
  • Configure network settings on all systems
  • Configure mod_proxy_balancer in Load Balancer

Server configuration

Configure two servers as web servers and one as load balancer.

Install Apache HTTP Server on load balancer, Web Server 1 and Web Server 2

Please install httpd package on the load balancer and Web Servers
yum -y install httpd
Make sure the service starts at boot time using chkconfig
chkconfig httpd on
Start httpd service
service httpd start

Configure network settings on all systems

Configure the network adapters to use the correct IP address by editing the following files;
Configure proper IP address settings on all the systems. After saving the files restart the network service.
service network restart
ifconfig command will display the IP address of each adapter. After configuration ping each other systems’ IP address to see whether they are accessible.
It is advisable to contact your web servers from the load balancer using their private IP addresses. Doing so minimizes your bandwidth charges by keeping all communication between servers on the ServiceNet network, where bandwidth is free.

Configure mod_proxy_balancer in Load Balancer

Make sure the following lines are uncommented so that the proper modules load.
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_balancer_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
open Apache configuration file;
Turn off ProxyRequests to avoid any unwanted traffic.
ProxyRequests off
Add the following lines to the end of the httpd.conf file;
[proxy] # Webserver1
# Webserver2
ProxySet lbmethod=byrequests

Save the file and run a configtest to check if there are any syntax errors
service httpd configtest
If there you see “Syntax OK” restart the service
service httpd restart


The balance-manager is a tool packaged with the mod_proxy_balancer tool, and it enables you to make configurations from a GUI tool through the web browser. You can view it at http://domain.com/balancer-manager.

SetHandler balancer-manager



This is the last part of the configuration, and adds the situations that will need to be proxied. You don’t want to proxy the balancer-manager, but you do want to proxy everything else.
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/

Now it’s time to check Failover. To test this go to either of the web servers and bring the network interface down.
ifdown eth0
Go to the browser and refresh the page it will display the contents of only the server whose network interface is up.


If you have all this configured in your httpd.conf file on your load balancer server, and you start Apache, you should be able to view your domain name that is properly pointed to your load balancer. When you refresh, it should hop between your two webservers, and balancing fine.

Get new insights right to your inbox

How can our experts help you?

Schedule your consultation

You may also like

  • By admin
  • in DevOps

Agile vs DevOps: What’s the difference

  • Nov 18, 2022 .
  • 9 min min
Read More
  • By admin
  • in DevOps

DevOps as a Service: All You Should Know

  • Aug 9, 2022 .
  • 9 min min
Read More
  • By admin
  • in Containerization

Containerization VS Virtualization: Understanding the Differences

  • Aug 4, 2022 .
  • 8 min min
Read More

Be in the know

Techno tips served hot! Subscribe now and stay atop.