问题描述
有一种情况,我们正在直接从另一个应用程序(A)与一组应用程序服务器(B)进行通信.由于两者都在同一个SAN中,因此我们进行了httpClient调用,该调用直接连接到应用程序服务器(从A到B).为了进行扩展,我们在两者之间放置了一个负载均衡器(httpclient请求从A到B),但是我们希望随后的请求转到应用程序(B)上的同一个JVM.因此,我们正在考虑是否可以在负载均衡器上配置会话关联性,如果您有经验或对如何解决此问题有深入的了解,请告诉我.
We have a situation, where we are talking to a set of app servers(B) directly from another application(A). Since both are within the same SAN, we are making the httpClient Call directly connecting to application servers(from A to B) . For scaling purposes, we have put a load balancer in between(httpclient requests from A to B), but we want to make the subsequent requests goto same JVM on application(B). Hence we are looking if we can configure session affinity on load balancer, if you have experiences or insight on how this problem can be solved please let me know.
推荐答案
最常见的方法是使用JSESSIONID之类的cookie来引导负载均衡器.
The most common way is to use a cookie like JSESSIONID to guide the load balancer.
例如,以Apache + mod_proxy_balancer为例:
With Apache + mod_proxy_balancer for example, define it like this:
ProxyPassMatch/.* balancer://mycluster stickysession = JSESSIONID | jsessionid
ProxyPassMatch /.* balancer://mycluster stickysession=JSESSIONID|jsessionid
这篇关于负载平衡器上的会话关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!