Procedure:
- As a Pre requisite we need to install Apache server with Apache Proxy Modules like mod_proxy, mod_proxy_http, mod_proxy_balancer and mod_lbmethod_byrequests
- You can verify by using httpd -M command
- You can also find modules in apache configuration file
# vi /etc/httpd/conf/httpd.conf
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_h
LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
- Restart apache server to after enable it.
Configuring Backend Server: I have created 3 application server with same App directory as follow.
http://10.0.0.1:5000/App
http://10.0.0.2:5000/App
http://10.0.0.3:5000/App
Configuring the Reverse Proxy: To configure apache reverse proxy load balancer we need to add some configuration in apache configuration file.
# vi /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
<Proxy balancer://cluster>
BalancerMember http://10.0.0.1:5000/App
BalancerMember http://10.0.0.2:5000/App
BalancerMember http://10.0.0.3:5000/App
ProxyPreserveHost On
ProxyPass / balancer://cluster/
ProxyPassReverse / balancer://cluster/
</VirtualHost>
Here ‘<Proxy balancer://cluster>’ is part where we mention the all the instances and 'ProxyPass' is handle all redirection. After making changes restart apache service.
# systemctl restart httpd
No comments:
Post a Comment