`
knight_black_bob
  • 浏览: 823943 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

tomcat session 共享 redis

阅读更多

 

tomcat session 共享 redis

简单操作,两步骤搞定 tomcat 集群 session共享,用于单点登录,web 集群等

 

jar包 及配置下载http://download.csdn.net/download/knight_black_bob/9821122

 

 

1.添加 redis session jar 到 tomcat中



 

2. 配置 tomcat  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>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->

    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->
    
    <Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve"/>       

    <!-- 
	<Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager" database="0" host="localhost" maxInactiveInterval="60" password="123456" port="6379"/>
	-->
    <Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager" database="0" host="localhost" maxInactiveInterval="60"  port="6379"/>

</Context>

 

本地没有 redis 密码 ,就去掉 password="123456" ....

 

 

 

 

 

 

 

捐助开发者 

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(支持支付宝和微信 以及扣扣群),没钱捧个人场,谢谢各位。

 

个人主页http://knight-black-bob.iteye.com/



 
 
 谢谢您的赞助,我会做的更好!

  • 大小: 59.6 KB
  • 大小: 101.8 KB
2
1
分享到:
评论
2 楼 knight_black_bob 2017-04-24  
yin_bp 写道
推荐一下bboss session:

bboss session框架,为web应用提供session共享和session监控功能。主要功能:支持集群session共享,支持跨域跨应用session共享,提供强大的统一session管理监控和统计查询功能,支持redis和mongodb两种存储机制;支持多种web容器(tomcat,jetty,weblogic,websphere等等)

https://my.oschina.net/bboss/blog/758871

  
1 楼 yin_bp 2017-04-24  
推荐一下bboss session:

bboss session框架,为web应用提供session共享和session监控功能。主要功能:支持集群session共享,支持跨域跨应用session共享,提供强大的统一session管理监控和统计查询功能,支持redis和mongodb两种存储机制;支持多种web容器(tomcat,jetty,weblogic,websphere等等)

https://my.oschina.net/bboss/blog/758871

相关推荐

Global site tag (gtag.js) - Google Analytics