利用redis实现session共享

利用redis实现session共享

1.安装Redis,请参考http://suyanzhu.blog.51cto.com/8050189/1944492


2.导入jar到tomcat的lib中

利用redis实现session共享


3.在tomcat的conf.xml中添加如下配置

<ValveclassName="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve"/>
<ManagerclassName="com.orangefunction.tomcat.redissessions.RedisSessionManager"
        host="192.168.17.4"
        port="6379"
        database="0"
        maxInactiveInterval="60" />


4.重新启动tomcat和nginx后进行访问验证

http://www.nginx1.com/