基于redis sentinel 的tomcat7 集群 session 共享

来源:互联网 发布:u型耳夹淘宝 编辑:程序博客网 时间:2024/05/21 10:14

1、架包

2、tomcat 配置content.xml

单点:


          <Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve" />
        <Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager"
                host="127.0.0.1"
                port="6379"
                database="0"
                maxInactiveInterval="60"/>

主从+哨兵

  <Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve" />
        <Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager"
               sentinelMaster="mymaster"
                sentinels="ip:26379,ip:26379,ip:26379"
                maxInactiveInterval="60"/>