Nginx + Tomcat + Redis Load balancer and session sharing

Source: Internet
Author: User
Tags nginx server
Overview

This document is used to describe Nginx+tomcat+redis load Balancer implementation session sharing

Required software and download address

Software name

Download Address

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

Startup and password configuration for Redis databases

Reference Address: http://jingyan.baidu.com/article/f25ef2546119fd482c1b8214.html

Redis and load server put an address and Nginx server

Redis Boot

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

Redis Setup Password

Opening:redis.windows.conf file

Ctrl+f looking for requirepass

Cancel the previous # sign and set your own password

Tomcat configuration Session sharing

1: Copy the required jar package to the Tomcat server lib directory

2: Configure conf directory under context.xml

< p="">

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

Nginx Load Balancer multiple Tomcat

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

The above describes the Nginx + Tomcat + Redis load balancing and session sharing, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.