1.基于Redis,使用开源解决方案RedisSessionManager解决多Tomcat实例的Session共享问题。
2.复制RedisSessionManager相关Jar包到:<Tomcat安装目录>/lib/下。
需要Tomcat配置文件:<Tomcat安装目录>/conf/context.xml
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve" />
<Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager"
host="localhost"
port="6379"
database="1"
maxInactiveInterval="30" />
</Context>
//host为Redis的IP地址,Port为Redis的端口,database为Redis的数据库,maxInactiveInterval 为超时时间。
参考资料:
相关推荐
redis tomcat7 session共享
包含的jar包如下: commons-pool2-2.0.jar jedis-2.5.2.jar tomcat-juli-adapters.jar tomcat-juli.jar tomcat-redis-session-manager1.2.jar
tomcat8 redis session共享,提供commons-pool2-2.3.jar,jedis-2.7.2.jar和修改后的tomcat-redis-session-manager-master-2.0.0.jar及部署文档
nignx 进行负载后session失效的完美解决,亲测可用
使用说明:请严格按照资源内的readme文档来说明部署,不要搞错版本,完美支持Tomcat8和Tomcat9等新版本Tomcat,仅支持JDK8以上版本JDK。
redis+tomcat集群配置session共享
linux.tomcat-session共享.redis.安装包
nginx+redis负载均衡、session共享,基于redis+tomcat实现session同步的简单demo
redis-tomcat-session共享包
基于redis实现tomcats ession共享与集群
实现redis安装,tomcat7负载共享session。 Linux+Nginx+Tomcat+Redis实现负载均衡,应用集群及session共享。
redis实现tomcat的session共享所需jar,主要是实现session共享的三个jar包,分别是commons-pool-1.5.4.jar、jedis-2.1.0.jar、tomcat-redis-session-manager-1.2-tomcat-7.jar
自己做的一个nginx+tomcat+redis完成session共享小例子,包括所需jar,适合初学者,希望大家一起学习交流
tomcat7 + redis + nginx 实现session共享的jar包
redis-tomcat67 session共享资源包,亲测可用。请放心下载使用。 redis-tomcat67 session共享资源包,亲测可用。请放心下载使用。
tomcat7 + redis单点 session共享 jar 提供支持tomcat7 + redis单点 实现session共享的jar资源
tomcat 基于redis session 共享 教程
适配与Tomcat7、8、9的redis session共享jar包
tomcat-redis-session-tomcat tomcat无缝集成redis实现tomcat集群session管理jar包
tomcat-redis实现session共享