[英]How to manage sessions in a distributed application
I have a Java web application which is deployed on two VMs.我有一个部署在两个 VM 上的 Java Web 应用程序。 and NLB (Network Load Balancing) is set for these VMs.
并且为这些 VM 设置了 NLB(网络负载平衡)。 My Application uses sessions.
我的应用程序使用会话。 I am confused that how the user session is managed in both VMs.
我很困惑如何在两个 VM 中管理用户会话。 ie For Example- If I make a request that goes to VM1 and create a user session.
即例如 - 如果我发出一个请求,该请求转到 VM1 并创建一个用户会话。 Now the second time I make request and it goes to VM2 and want to access the session data.
现在我第二次发出请求,它转到 VM2 并想要访问会话数据。 How would it find the session which has been created in VM1.
它如何找到已在 VM1 中创建的会话。
Please Help me to clear this confusion.请帮我清除这个困惑。
There are several solutions:有几种解决方案:
You'll have to look in the documentation of your server to see what is possible with that server, or use a third-party solution.您必须查看服务器的文档以了解该服务器的功能,或使用第三方解决方案。
我们可以使用分布式Redis来存储会话,这可以解决这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.