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)

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 configure nginx in Windows How to configure nginx in Windows Apr 14, 2025 pm 12:57 PM

How to configure Nginx in Windows? Install Nginx and create a virtual host configuration. Modify the main configuration file and include the virtual host configuration. Start or reload Nginx. Test the configuration and view the website. Selectively enable SSL and configure SSL certificates. Selectively set the firewall to allow port 80 and 443 traffic.

How to configure Lua script execution time in centos redis How to configure Lua script execution time in centos redis Apr 14, 2025 pm 02:12 PM

On CentOS systems, you can limit the execution time of Lua scripts by modifying Redis configuration files or using Redis commands to prevent malicious scripts from consuming too much resources. Method 1: Modify the Redis configuration file and locate the Redis configuration file: The Redis configuration file is usually located in /etc/redis/redis.conf. Edit configuration file: Open the configuration file using a text editor (such as vi or nano): sudovi/etc/redis/redis.conf Set the Lua script execution time limit: Add or modify the following lines in the configuration file to set the maximum execution time of the Lua script (unit: milliseconds)

How to check whether nginx is started How to check whether nginx is started Apr 14, 2025 pm 01:03 PM

How to confirm whether Nginx is started: 1. Use the command line: systemctl status nginx (Linux/Unix), netstat -ano | findstr 80 (Windows); 2. Check whether port 80 is open; 3. Check the Nginx startup message in the system log; 4. Use third-party tools, such as Nagios, Zabbix, and Icinga.

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 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 install redis in centos7 How to install redis in centos7 Apr 14, 2025 pm 08:21 PM

How to start nginx How to start nginx Apr 14, 2025 pm 01:06 PM

Question: How to start Nginx? Answer: Install Nginx Startup Nginx Verification Nginx Is Nginx Started Explore other startup options Automatically start Nginx

See all articles