LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
Modifications to httpd.conf
The load balancer configuration that I did were for servers with no sticky-ness.
<ifmodule mod_proxy_balancer.c>
ProxyPass /balancer balancer://server
<Proxy balancer://server>
BalancerMember http://host1/server loadfactor=1 route=jvm1
BalancerMember http://host2/server loadfactor=1 route=jvm1
</proxy>
</ifmodule>
Above load balancer configuration will balance the load 50:50 across host1 and host2 for Apache web server URL http://apache_host/balancer.
Modifications to Tomcat's server.xml
Your Tomcat's conf/server.xml file needs to have "Engine" element looking like this:
<Engine name="Catalina" defaulthost="localhost" jvmroute="jvm1">
Allowing the httpd connect on SELinux
One issue I faced on SELinux was even with above configuration, I was getting the connection failed error in Apache Web-server logs. After little-bit of googling, I found that, I had to do following to allow httpd modules to connect to the network.
# /usr/sbin/setsebool httpd_can_network_connect 1
OR
# /usr/sbin/setsebool httpd_can_network_connect true
Or you can also set the security settings, Go to Security Level configurations and Change Tab to SELinux. And modify SELinux policy Check “Allow HTTPD scripts and modules to connect to the network” under HTTPD service.
No comments:
Post a Comment