【问题标题】:apache http server load balancer monitoringapache http 服务器负载均衡器监控
【发布时间】:2014-05-03 06:12:48
【问题描述】:

我使用 mod-proxy 模块将 apache http 服务器配置为负载均衡器

<Proxy balancer://clusterABCD>
    BalancerMember http://192.168.0.222:8080/geoserver/wms loadfactor=8
    BalancerMember http://192.168.0.14:8081/geoserver/wms loadfactor=8
    BalancerMember http://192.168.0.222:8082/geoserver/wms status=+H
    ProxySet lbmethod=bytraffic
    Order allow,deny
    Allow from all
</Proxy>

ProxyPass /LGroup balancer://clusterABCD/

有什么方法可以监控负载均衡器的功能

我的问题是

  1. 有什么方法可以找到正在处理请求的 BalanceMember
  2. 是否有任何设置可用于增加功能

提前感谢

【问题讨论】:

  • “增加功能”是什么意思?您想更改代理行为吗?
  • 对不起,这是一个错误,我的意思是提高可用性

标签: apache tomcat proxy load-balancing mod-proxy


【解决方案1】:

回答您的两个问题,是的,这是可能的,但您需要通过 Mod Proxy 增强 Apache 负载平衡的配置才能使用此功能。

我建议您使用下面的示例设置:

<VirtualHost *:80>
ProxyRequests off

ServerName servername.local

<Proxy balancer://mycluster>
        # TomcatA
        BalancerMember http://172.20.20.101:8080 route=tomcatA
        # TomcatB
        BalancerMember http://172.20.20.102:8080 route=tomcatB
        # TomcatC
        BalancerMember http://172.20.20.103:8080 route=tomcatC


        # Security – to determine who is allowed to access
        # Currently all are allowed to access
        Order Deny,Allow
        Deny from none
        Allow from all

        # Load Balancer Settings
        # We will be configuring a simple Round
        # Robin style load balancer.  This means
        # that all nodes take an equal share of
        # of the load.
        ProxySet lbmethod=byrequests

</Proxy>

# balancer-manager
# This tool is built into the mod_proxy_balancer
# module and will allow you to do some simple
# modifications to the balanced group via a gui
# web interface.
<Location /balancer-manager>
        SetHandler balancer-manager

        # I recommend locking this one down to your
        # administering location
        Order deny,allow
        Allow from all
</Location>

# Point of Balance
# This setting will allow to explicitly name the
# location in the site that we want to be
# balanced, in this example we will balance "/"
# or everything in the site.
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=Off scolonpathdelim=On

要查看余额请求,您需要拥有该模块

mod_proxy_balancer

安装,然后使用上面的配置。

关于可用性,它取决于负载均衡器设置,轮询方法在节点之间平均共享流量,并且被视为可能是可用性的最佳选择:

ProxySet lbmethod=byrequests

此外,如果您正在考虑将请求从 Apache 共享到应用服务器,则需要配置到 AJP 而不是 HTTP 端口,同时需要对应用程序服务器(例如 Tomcat)进行更改。更多详情请访问:

Load Balancing: Apache versus Physical Appliance

【讨论】:

    【解决方案2】:

    可能太简单了,但是监控平衡器成员的(访问)日志呢?这应该会告诉您,哪个成员正在处理请求。

    【讨论】: