?
? 原文:http://www.javaarch.net/jiagoushi/1024.htm
?
在Apache Tomcat 7设置redis作为session store redis已经有组件支持直接在tomcat7中设置下将redis作为tomcat默认的session存储器,下面介绍下配置过程 1.从http://redis.io/下载redis,按照redis服务端 wget http://download.redis.io/redis-stable.tar.gz tar xvzf redis-stable.tar.gz cd redis-stable make 2.启动redis cd RedisDirectory/src ./redis-server --port 6379 3.从http://tomcat.apache.org/download-70.cgi下载tomcat7,按照tomcat7 4.从https://github.com/xetorthio/jedis/downloads下载jedis作为java的redis客户端,从https://github.com/jcoleman/tomcat-redis-session-manager/downloads下载tomcat的redis session manager插件,从http://commons.apache.org/proper/commons-pool/download_pool.cgi下载apache的common pool包,将这几个jar包拷贝到tomcat7的lib目录下 5.修改tomcat的conf下的context.xml文件,添加或者修改下面的配置 <Valve className="com.radiadesign.catalina.session.RedisSessionHandlerValve" /> <Manager className="com.radiadesign.catalina.session.RedisSessionManager" host="localhost" <!-- optional: defaults to "localhost" --> port="6379" <!-- optional: defaults to "6379" --> database="0" <!-- optional: defaults to "0" --> maxInactiveInterval="60" <!-- optional: defaults to "60" (in seconds) --> /> 6.重启tomcat后就可以看到session存储到redis上了。 英文原文:http://shivganesh.com/category/database/no-sql/redis-no-sql/
?