Overview
This document is used to describe Nginx+tomcat+redis load Balancer implementation session sharing
The required software and
Software name |
|
Function description |
nginx-v1.6.0 |
Http://nginx.org/download/nginx-1.6.0.tar.gz |
Load Balancing |
Commons-pool-2-2.4.2.jar |
Http://mirrors.hust.edu.cn/apache//commons/pool/binaries/commons-pool2-2.4.2-bin.tar.gz |
|
Jedis-2.7.3.jar |
Http://central.maven.org/maven2/redis/clients/jedis/2.7.3/jedis-2.7.3.jar |
|
Tomcat-redis-session-manager1.2.jar |
http://download.csdn.net/download/qinxcb/8279761 |
|
Redis |
Https://github.com/ServiceStack/redis-windows/blob/master/downloads/redis64-2.8.9.zip |
Redis Database Windows version |
Redisdatabase Startup and password configuration
Reference Address: http://jingyan.baidu.com/article/f25ef2546119fd482c1b8214.html
Redis and load server put an address and Nginx server
RedisStart
Extract:
CMD command
Use the CD command to go to the directory where the Redis-server.exe is located
Run the Redis-server.exe redis.windows.conf command to start the redis Database
RedisSet Password
Opening:redis.windows.conf file
Ctrl+f looking for requirepass
Cancel the previous # sign and set your own password
TomcatConfigurationSessionshared1: Put the requiredJarpackage is copied toTomcatServerLibdirectory under
2:Configurationconfdirectory undercontext.xml
<valve classname= "Com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve"/>
<manager classname= "Com.orangefunction.tomcat.redissessions.RedisSessionManager"
Host= "127.0.0.1"
Port= "6379"
password= "Root"
database= "0"
Maxinactiveinterval= "/>"
Host: point to the IP address where the load server resides
If the redis Database has a password set: To be set to a consistent
NginxLoad Balancing MultipleTomcat
Open nginx.conf
Locate the upstream node
Directly copy multiple Tomcat Service ports to configure the same weights;
Boot order for various services
Redis database = == "Tomcat server = = ="Nginx Server
Nginx+tomcat+redis load balancing and session sharing