我使用mod-proxy模块将apache http服务器配置为充当负载平衡器,但是当我运行50个并发用户时,负载分布不均。所有请求都将发送到eigher服务器1或服务器2。
有什么方法可以监视负载均衡器或平均分配负载?
ProxyRequests off
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
<Proxy balancer://executeeditchecks>
BalancerMember http://172.50.3.6:9038/executeeditchecks route=server-044
BalancerMember http://172.50.3.3:9038/executeeditchecks route=server-003
ProxySet lbmethod=byrequests
ProxySet stickysession=ROUTEID
</Proxy>
<Proxy balancer://editcheckexecution>
BalancerMember http://172.50.3.6:9038/editcheckexecution route=server-044
BalancerMember http://172.50.3.3:9038/editcheckexecution route=server-003
ProxySet lbmethod=byrequests
ProxySet stickysession=ROUTEID
</Proxy>
Listen 7070
<VirtualHost *:7070>
ProxyPass /executeeditchecks balancer://executeeditchecks/
ProxyPassReverse /executeeditchecks balancer://executeeditchecks/
ProxyPass /editcheckexecution balancer://editcheckexecution/
ProxyPassReverse /editcheckexecution balancer://editcheckexecution/
</VirtualHost>
答案 0 :(得分:0)
您可以使用平衡器管理器查看有关平衡器的更多详细信息。
请参见https://httpd.apache.org/docs/2.4/mod/mod_proxy_balancer.html的“ 启用Balancer Manager支持”
通过添加
<Location "/balancer-manager">
SetHandler balancer-manager
</Location>
别忘了对该URL设置访问限制,因为也可以在那里禁用工作程序。