Nginx+tomcat+redis load balancing and session sharing

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.