tomcat8.5+redis实现session共享

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xuxile/article/details/80368231

1.下载所需jar

commons-pool2-2.3.jar

jedis-2.7.3.jar

tomcat-redis-session-manager-master-2.0.0.jar

下载地址:https://download.csdn.net/download/xuxile/10423716

2.修改tomcat的配置文件context.xml,<Context>标签中追加如下配置:

	<!-- 基于缓存数据库的Session共享配置开始 -->
	<Valve className="com.naritech.nicole.gump.RedisSessionHandlerValve" />
	<Manager className="com.naritech.nicole.gump.RedisSessionManager"
    database="1"    
	maxInactiveInterval="1800" 
    sentinelMaster="mymaster"
    sentinels="172.31.12.71:7030,172.31.12.72:8060,172.31.12.73:8050"/>
	<!-- 基于缓存数据库的Session共享配置结束 -->
3.重启tomcat即可生效!


猜你喜欢

转载自blog.csdn.net/xuxile/article/details/80368231