Apache mod-proxy 负载均衡器维护
我将 mod-proxy 和 mod-proxy-balancer 设置为负载平衡反向代理。 像这样的事情:
<Proxy balancer://example>
BalancerMember http://hostname:8000 keepalive=on
BalancerMember http://hostname:8001 keepalive=on
</Proxy>
ProxyPass / balancer://example/
ProxyPassReverse / balancer://example/
ProxyPreserveHost on
ProxyRequests Off
是否有一种简单的方法可以将其设置为在平衡器组的所有成员都关闭时显示静态维护页面? 我之前已经使用硬件负载平衡器做到了这一点,它非常有用。
I have mod-proxy and mod-proxy-balancer setup as a load balancing reverse proxy. Something like this:
<Proxy balancer://example>
BalancerMember http://hostname:8000 keepalive=on
BalancerMember http://hostname:8001 keepalive=on
</Proxy>
ProxyPass / balancer://example/
ProxyPassReverse / balancer://example/
ProxyPreserveHost on
ProxyRequests Off
Is there a simple way to set this up to show a static maintenance page when all members of the balancer group are down? I've done that with a hardware load balancer previously and it was very useful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
也许您可以使用热备。 下面的示例来自 ProxyPass Directive 部分,其中显示“设置热备,只有在没有其他成员可用时才会使用”
Maybe you can use a hot standby. The example below is from the ProxyPass Directive section where it says "Setting up a hot-standby, that will only be used if no other members are available"
作为 RewriteRule 的替代方案,您可以使用适当的 ErrorDocument 指令执行相同的操作。 我们做这样的事情,其中代理服务器本身托管静态错误页面,“热备用”主机是 http:// /localhost/some-app/。
As an alternative to RewriteRule you can do the same thing with appropriate ErrorDocument directives. We do something like this in which the proxy server itself hosts static error pages and the "hot-standby" host is http://localhost/some-app/.
由于您的代理似乎是唯一的页面(可能在虚拟主机中),因此您可以简单地覆盖错误页面。 Apache 会产生 503 错误,因此看起来像这样:
如果您想在维护 html 中使用图像,请注意您必须使用绝对路径(例如 /image.jpg)来加载 /var/www/html/image。 .jpg。
Since your proxy seems to be the only page (probably in a VirtualHost), you can simply override error pages. Apache produces a 503 error, so this would look like:
If you want to use images inside the maintenance html, please not that you have to use absolute paths (e.g. /image.jpg) will load /var/www/html/image.jpg.