Home Backend Development PHP Tutorial Nginx + Tomcat + Redis load balancing and session sharing

Nginx + Tomcat + Redis load balancing and session sharing

Jul 29, 2016 am 09:06 AM
nbsp nginx quot redis tomcat

Overview

This document is used to describe in detail the nginx+tomcat+redisload balancing implementationsessionsharing

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

Redisdatabase startup and password configuration

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

Put an address on Redis and load server and Nginx server

RedisStart

Decompression:

Cmd command

Use The cd command goes to the directory where redis-server.exe is located. Run the redis-server.exe redis.windows.conf command to start the database. Set the password. Open:

redis.windows. conf

file Ctrl+F

Look for

requirepass

Cancel the previous #number and set your own password

TomcatConfigurationSession

Share

1: check the place The

jar

package needs to be copied to the tomcat server

lib

directory 2: configuration conf directory context.xml

host="127.0.0.1" port="6379" Password "root" database="0" maxInactiveInterval="60" //>

Host:

points to the

ip

address where the load server is located

such as

redis

The database has a password set: To set up a consistent

Nginxload balancing multiple Tomcatopen

nginx.conf

find the upstream

node

directly copy multiple Tomcat

service ports to configure the same weight. Yes;

Startup sequence of various services

RedisDatabase====

TomcatServer

====

NginxServer The above introduces Nginx + Tomcat + Redis load balancing and session sharing, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1653
14
PHP Tutorial
1251
29
C# Tutorial
1224
24
How to check the name of the docker container How to check the name of the docker container Apr 15, 2025 pm 12:21 PM

You can query the Docker container name by following the steps: List all containers (docker ps). Filter the container list (using the grep command). Gets the container name (located in the "NAMES" column).

How to start containers by docker How to start containers by docker Apr 15, 2025 pm 12:27 PM

Docker container startup steps: Pull the container image: Run "docker pull [mirror name]". Create a container: Use "docker create [options] [mirror name] [commands and parameters]". Start the container: Execute "docker start [Container name or ID]". Check container status: Verify that the container is running with "docker ps".

How to create containers for docker How to create containers for docker Apr 15, 2025 pm 12:18 PM

Create a container in Docker: 1. Pull the image: docker pull [mirror name] 2. Create a container: docker run [Options] [mirror name] [Command] 3. Start the container: docker start [Container name]

How to configure slow query log in centos redis How to configure slow query log in centos redis Apr 14, 2025 pm 04:54 PM

Enable Redis slow query logs on CentOS system to improve performance diagnostic efficiency. The following steps will guide you through the configuration: Step 1: Locate and edit the Redis configuration file First, find the Redis configuration file, usually located in /etc/redis/redis.conf. Open the configuration file with the following command: sudovi/etc/redis/redis.conf Step 2: Adjust the slow query log parameters in the configuration file, find and modify the following parameters: #slow query threshold (ms)slowlog-log-slower-than10000#Maximum number of entries for slow query log slowlog-max-len

How to use the Redis cache solution to efficiently realize the requirements of product ranking list? How to use the Redis cache solution to efficiently realize the requirements of product ranking list? Apr 19, 2025 pm 11:36 PM

How does the Redis caching solution realize the requirements of product ranking list? During the development process, we often need to deal with the requirements of rankings, such as displaying a...

How to install redis in centos7 How to install redis in centos7 Apr 14, 2025 pm 08:21 PM

How to install mirror offline in docker How to install mirror offline in docker Apr 15, 2025 am 11:36 AM

Installing Docker images offline requires the following steps: 1. Obtain the mirror TAR file; 2. Export the mirror file; 3. Transfer the mirror file; 4. Import the mirror file; 5. Verify the mirror installation.

Choosing Between NGINX and Apache: The Right Fit for Your Needs Choosing Between NGINX and Apache: The Right Fit for Your Needs Apr 15, 2025 am 12:04 AM

NGINX and Apache have their own advantages and disadvantages and are suitable for different scenarios. 1.NGINX is suitable for high concurrency and low resource consumption scenarios. 2. Apache is suitable for scenarios where complex configurations and rich modules are required. By comparing their core features, performance differences, and best practices, you can help you choose the server software that best suits your needs.

See all articles