HAProxy 和“分片”

发布于 2024-07-25 08:36:39 字数 490 浏览 3 评论 0原文

我想知道是否有人使用过 HAProxy 进行分片。 具体来说,我希望能够使用我定义的带有标识符的 cookie,并让任何提供该 cookie/标识符组合的客户端定向到同一服务器。 这似乎是可能的,我的初步测试似乎有效,但我不确定。

我的监听配置如下所示:

listen  appli1-rewrite 0.0.0.0:80
cookie  mysession= prefix
balance roundrobin
server  app1_1 192.168.0.1:80 cookie server01
server  app1_2 192.168.0.2:80 cookie server02

option  httpclose

但是,当我使用 Live Http Headers 查看请求标头时,我没有看到 mysession cookie 指示它将前往哪个服务器,这是我根据前缀操作所期望的。 我对 HAProxy 很陌生,所以任何帮助/指导都会很棒!

I was wondering if anyone has used HAProxy for sharding.
Specifically, I would like to be able use a cookie I define w/a identifier and have any client that presents that cookie/identifier combination be directed to the same server. It seems possible and my preliminary tests seem to work but I am not a sure.

My listen configuration looks like:

listen  appli1-rewrite 0.0.0.0:80
cookie  mysession= prefix
balance roundrobin
server  app1_1 192.168.0.1:80 cookie server01
server  app1_2 192.168.0.2:80 cookie server02

option  httpclose

However, when I look at the request headers using Live Http Headers I don't see the mysession cookie indicating which server it will be going to, which is what I expected based on the prefix operation.
I am quite new to HAProxy so any help/guidance would be great!

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甩你一脸翔 2024-08-01 08:36:39

根据HAProxy文档,我认为你需要稍微调整你的haproxy配置,让它插入cookie:

根据:

http://haproxy.1wt.eu/download/1.2/doc/architecture.txt

您需要类似:

cookie SERVERID 间接插入

According to the HAProxy docs I think you need to tweak your haproxy config a little, to have it insert the cookie:

According to:

http://haproxy.1wt.eu/download/1.2/doc/architecture.txt

You need something like:

cookie SERVERID insert indirect

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文