redis集群共享session配置

2/22/2017来源:ASP.NET技巧人气:1229

单点配置

<Context>

   <WatchedResource>WEB-INF/web.xml</WatchedResource>

   <ValveclassName="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve"/>

   <Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager"

        host="192.168.254.10"

        port="6379"

        database="0"

         maxInactiveInterval="60"/>

</Context>

 

基于redis的集群配置如下:

<ValveclassName="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve"/>        

<ManagerclassName="com.orangefunction.tomcat.redissessions.RedisSessionManager" 

    maxInactiveInterval="60"

    sentinelMaster="mymaster"

    sentinels="127.0.0.1:26379,127.0.0.1:26380,127.0.0.1:26381,127.0.0.1:26382"/>