大网数据广告活动
服务器运维问答

Can apache load balancer find if one of it's balancer members is down?

· 52CE 我爱测

I need to know if apache can wisely and automatically detect if one of it's balanerMembers is down and consequently exempt it from serving the requests? P.S. The back-end servers won't produce heartbeat. Thanks Comments: I'm usin…

问题原文

原帖链接 · Ehsan Mahdavi · CC BY-SA 3.0

I need to know if apache can wisely and automatically detect if one of it's balanerMembers is down and consequently exempt it from serving the requests?

P.S. The back-end servers won't produce heartbeat.

Thanks

Comments: I'm using mod_proxy in apache 2.4.7 My configuration for a sample site is like below, My problem is when one of the back-end servers goes unresponsive, My load balancer still sends requests to the dead back-end server and clients are complaining. What is wrong with the below config:

<Proxy balancer://X_Balancer>
    BalancerMember http://firsthost.sth/ status=-SE
    BalancerMember http://anotherhost.sth/ status=-SE
    ProxySet lbmethod=bybusyness
</Proxy>
<VirtualHost IPofloadbalancer:80>
    ServerName domainname
    SSLProxyEngine On
    Include /*/modsecurity.conf
    <location />
        ProxyPass balancer://X_Balancer/
        ProxyPassReverse balancer://X_Balancer/
    </location>
</VirtualHost>

已采纳解答

原帖链接 · HBruijn · CC BY-SA 3.0

If you use mod_proxy in Apache 2.2 you have limited configuration options, but Apache will detect unresponsive balancerMembers and distribute requests to any remaining balancerMembers.

Apache 2.4 has already some more options, but for more advanced options you're typically better off with more specialized load balancer software.

After your comments: It depends on how the balancerMember stops responding. If a connection can still be made, but no error code and no response is forthcoming you might benefit from setting the timeout and failontimeout options.

<Proxy balancer://X_Balancer>
    BalancerMember http://firsthost.sth/ status=-SE timeout=5 retry=60
    BalancerMember http://anotherhost.sth/ status=-SE timeout=5 retry=60
    ProxySet lbmethod=bybusyness failontimeout=on
</Proxy>

timeout=5 Connection timeout in seconds. The number of seconds Apache httpd waits for data sent by / to the backend.
failontimeout=on If set, an IO read timeout after a request is sent to the backend will force the worker into error state. Worker recovery behaves the same as other worker errors.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-07-02)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。