Menu

Sunday 17 June 2018

Apache Configure mod_proxy as load balancer (LB)- JBoss 7.1




Connector
Supports Sticky Sessions
Adapts to Deployment Status
Yes
Yes. Detects deployment and undeployment of applications and dynamically decides whether to direct client requests to a server based on whether the application is deployed on that server.
Yes
No. Directs client requests to the container as long as the container is available, regardless of application status.
Yes
No. Directs client requests to the container as long as the container is available, regardless of application status.
Yes
No. Directs client requests to the container as long as the container is available, regardless of application status.
Yes
No. Directs client requests to the container as long as the container is available, regardless of application status.


Software Details:
**  JBoss-as-7.1.1.Final**
** Apache HTTPServer 2.4.33 - WINDOWS**

Step 1: Enable list of modules for mod_proxy as load balancer.
  • ·         mod_proxy.so
  • ·         mod_proxy_balancer.so
  • ·         mod_proxy_connect.so
  • ·         mod_proxy_http.so


Step 2: Enable list of below modules for Load balancer scheduler algorithm.
  • ·         mod_lbmethod_bybusyness.so
  • ·         mod_lbmethod_byrequests.so
  • ·         mod_lbmethod_bytraffic.so
  • ·         mod_lbmethod_heartbeat.so


Step 3: Enable below module for balancer-manager status.
  • ·         mod_status.so  


Step 4: Edit httpd.conf file Add below configuration.

#################################################

<Proxy balancer://mybalancer>

BalancerMember http://192.168.0.103:8080   route=node1 loadfactor=1 ping=10 ttl=600 keepalive=On
BalancerMember http://192.168.0.103:8090   route=node2 loadfactor=1 ping=10 ttl=600 keepalive=On
proxyset lbmethod=bytraffic 

</Proxy>

########################################################

ProxyPreserveHost On

ProxyPass /sample   balancer://mybalancer/sample  stickysession=JSESSIONID|jsessionid timeout=10 nofailover=On
ProxyPassReverse /sample   balancer://mybalancer/sample

ProxyPass  /calendar   balancer://mybalancer/calendar  stickysession=JSESSIONID|jsessionid timeout=10 nofailover=On
ProxyPassReverse  /calendar     balancer://mybalancer/calendar

ProxyPass /hello   balancer://mybalancer/hello  stickysession=JSESSIONID|jsessionid timeout=10 nofailover=On
ProxyPassReverse /hello   balancer://mybalancer/hello

#######################################################



Where,
  • ·                        mybalancer (balancer variable name)
  • ·                       BalancerMember [IP]:[PORT]  
  • ·                        proxyset lbmethod=bytraffic   (load balancer scheduler algorithms)
  • ·                        stickysession=JSESSIONID|jsessionid (load balancer stickiness)
  • ·                        ProxyPass /App   balancer://mybalancer/app 
NOTE : Enable Sticky Sessions A sticky session means that if a client request originally goes to a specific JBoss worker, all future requests will be sent to the same worker, unless it becomes unavailable.




Screenshot:






Step 5: For balancer-manager status add below configuration in httpd.conf

Note: Enable mod_status module

####################################################
<Location "/balancer-manager">
    SetHandler balancer-manager
    Order deny,allow
    Deny from all
    Allow from localhost 192.168.0.103
</Location>

ProxyPass /balancer-manager !

####################################################


Screenshot:





















**************************************************
JBoss level Configuration :



Step 6 : Add the system-properties  to provide the jvmRoute and value.

             Note: Make same changes to another JBoss sever node2 - (standalone.xml)
      

  <system-properties>

        <property name="jvmRoute" value="node1"/>

  </system-properties> 








Reference link:



Thanks :-)





No comments:

Post a Comment