1负载均衡的2台服务器:
服务器 | ip | 端口 | tomcat | jdk |
tomcat1 | 10.6.4.143 | 8081 | 7.0 | 1.7 |
tomcat2 | 10.6.4.143 | 8082 | 7.0 | 1.7 |
负载均衡配置截图:
2:配置tomcat
a:现在环境依赖的jar包:tomcat-redis-session-manager-1.2-tomcat-7-java-7.jar;jedis-2.5.2.jar;commons-pool2-2.0.jar
b:配置tomcat的context.xml文件,添加一下内容:
<Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve" />
<Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager"
host="10.6.2.212"
port="6379"
database="0"
maxInactiveInterval="60" />
3:启动tomcat,启动nginx,访问:yy.elanbai.com(需要添加测试页index.jsp)
原文:http://www.cnblogs.com/waitforever/p/5166610.html