LAMT基于mod_proxy负载均衡

2023年 7月 15日 44.1k 0

mod_proxy负载均衡LAMT基于mod_proxy调度使用基于mod_proxy负载均衡需要proxy_balancer_module (shared)模块的支持

修改mod_proxu.conf文件,添加两台tomcat主机,lb为负载均衡命名

[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可以实现回话保持修改 workers.properties ,添加如下内容,分别是8009(mod_proxy可以http和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]# 


状态信息

[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/
——————————————————————状态信息—————————————————————————
<Location /lbmanager>
        SetHandler balancer-manager
</Location>
ProxyPass /lbmanager !
————————————————————————————————————————————————————————
<Location />
        Order Allow,Deny
        Allow from all
</Location>

mod_proxy负载均衡.png

相关文章

LeaferJS 1.0 重磅发布:强悍的前端 Canvas 渲染引擎
10分钟搞定支持通配符的永久有效免费HTTPS证书
300 多个 Microsoft Excel 快捷方式
一步步配置基于kubeadmin的kubevip高可用
istio全链路传递cookie和header灰度
REST Web 服务版本控制

发布评论