Apache httpd mod_proxy_balancer:向所有集群成员广播?

发布于 2025-01-01 18:28:41 字数 708 浏览 3 评论 0原文

我有一些 HTTP/PHP 服务器,前端是 Apache/mod_proxy_balancer 负载均衡器,典型的集群设置如下:

<Proxy balancer://mycluster>
    BalancerMember http://192.168.1.10
    BalancerMember http://192.168.1.11
    BalancerMember http://192.168.1.12
    BalancerMember http://192.168.1.13
</Proxy>

我的问题:有没有办法配置 Apache,以便可以将某些特定请求发送给集群的所有成员成为一个人代理的标准?

我问这个问题是因为我的集群中的每个成员都使用基于 XCache 的本地数据缓存。每个成员都有一个可通过 http 访问的脚本来取消设置其自身的特定缓存项。在一些罕见的事件中,我需要清除所有服务器上的相同缓存条目。

我可以制作一个单独的 bash/curl 脚本来按顺序访问每个服务器,但由于集群定义位于我的 httpd.conf 中,因此不必将其复制到其他地方会更容易,并且另外,我希望在负载均衡器本身上保留一个可卷曲的端点来进行全局缓存清除。

注意:我不是询问有关内存缓存的问题。我已经将内存缓存用于其他用途,其中服务器需要同步存储。在本例中,我使用 Xcache 进行几乎持久的、无需同步的数据缓存。

I have a few HTTP/PHP servers fronted by an Apache/mod_proxy_balancer load balancer, with a typical cluster setup as below:

<Proxy balancer://mycluster>
    BalancerMember http://192.168.1.10
    BalancerMember http://192.168.1.11
    BalancerMember http://192.168.1.12
    BalancerMember http://192.168.1.13
</Proxy>

My question: is there a way to configure Apache such that some specific requests can be sent to all members of the cluster instead of being the standard proxied to one?

I ask because each member in my cluster uses a local data cache based on XCache. Each member has a http-accessible script to unset specific cache item on itself. On some rare events, I need to clear the same cache entry on all servers.

I could make a separate bash/curl script to hit each server in sequence, but since the cluster definition is in my httpd.conf, it'd be easier to not have to copy it somewhere else, and also, I'm hoping to retain a curl-able endpoint on the load balancer itself to do a global cache clearing.

Note: I am not asking about memcache. I'm already using memcache for other things, where servers need to have synchronized storage. In this case I use Xcache for almost-persistent, no-sync-required, data caching.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文