Redis如何工作以帮助Window Azure保持会话持久性 [英] How do redis works to help In session persistence in window azure

查看:63
本文介绍了Redis如何工作以帮助Window Azure保持会话持久性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们在云上部署应用程序并管理流量时,我们使用负载平衡器.

When we deploy our application on cloud, and to manage the traffic we use load balancer.

现在,如果用户通过负载平衡器命中服务器1,则将与该服务器建立会话,并且一段时间后,负载平衡器会将其命中引用到服务器2.他们的新会话会再次创建吗?

Now if a user hits server 1 through load balancer, their session is created with that server, and after some time their hit is referred to server two by load balancer. Will their new session will be created again?

如果确实发生了这种情况,而我在整个交互过程中都使用redis缓存来维护他们的会话,那么redis如何管理所有服务器之间的会话持久化?

If this does happen, and I use redis cache to maintain their session throughout his interaction, then how does redis manage persist the session across all servers?

推荐答案

您将需要将应用程序指向中央Redis缓存.您的缓存独立于Web应用程序运行,并且此Web应用程序的所有会话数据都将存储在此Redis缓存中.此处( https://docs.microsoft.com/en-us/azure/redis-cache/cache-aspnet-session-state-provider )是如何配置ASP.NET应用程序以使用Redis会话状态提供程序的方法.

You will need to point your application to a central Redis Cache. Your cache is running independently from your web application and all the session data for this web application will be stored in this Redis cache. Here (https://docs.microsoft.com/en-us/azure/redis-cache/cache-aspnet-session-state-provider) is how you can configure an ASP.NET application to use the Redis Session State provider.

这篇关于Redis如何工作以帮助Window Azure保持会话持久性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆