Mod_proxy Load Balancing
Lamt based on Mod_proxy scheduling
Support for Proxy_balancer_module (shared) modules based on mod_proxy load balancing
Modify mod_proxu.conf file, add two tomcat hosts, LB for load balancing name
[Root@nginx-proxy2 conf.d]# Cat mod_proxy.conf
Proxyvia on
Proxyrequests off
Proxypreservehost on
<proxy balancer://lb>
Balancermember http://10.0.0.53:8080 loadfactor=1 Route=tomcata
Balancermember http://10.0.0.54:8080 loadfactor=1 ROUTE=TOMCATB
</Proxy>
Proxypass/balancer://lb/stickysession=jsessionid
proxypassreverse/balancer://lb/
<location/>
Order Allow,deny
Allow from all
</Location>
[Root@nginx-proxy2 conf.d]#
Stickysession=jsessionid can be implemented to maintain
Modify Workers.properties, add the following, 8009 (Mod_proxy can be http and AJP)
[Root@nginx-proxy2 conf.d]# Cat Workers.properties
Worker.list=lbca,stata
Worker. tomcata.port=8009
Worker. tomcata.host=10.0.0.53
Worker. Tomcata.type=ajp13
Worker. Tomcata.lbfactor=1
Worker. tomcatb.port=8009
Worker. tomcatb.host=10.0.0.54
Worker. Tomcatb.type=ajp13
Worker. Tomcatb.lbfactor=1
Worker.lbca.type=lb
Worker.lbca.sticky_session=0
Worker.lbcA.balance_workers = TOMCATA,TOMCATB
Worker.statA.type = Status
[Root@nginx-proxy2 conf.d]#
Status information
[Root@nginx-proxy2 conf.d]# Cat mod_proxy.conf
Proxyvia on
Proxyrequests off
Proxypreservehost on
<proxy balancer://lb>
Balancermember http://10.0.0.53:8080 loadfactor=1 Route=tomcata
Balancermember http://10.0.0.54:8080 loadfactor=2 ROUTE=TOMCATB
</Proxy>
proxypass/balancer://lb/
proxypassreverse/balancer://lb/
—————————————————————— status information —————————————————————————
<Location/lbmanager>
SetHandler Balancer-manager
</Location>
Proxypass/lbmanager!
————————————————————————————————————————————————————————
<location/>
Order Allow,deny
Allow from all
</Location>