Nginx + Tomcat + Redis load balancing and session sharing
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. conffile Ctrl+F
Look forrequirepass
Cancel the previous #number and set your own password
TomcatConfigurationSession
Share1: check the place The
jarpackage needs to be copied to the tomcat server
lib directory 2: configuration conf directory context.xml
Host:
points to the ip address where the load server is locatedsuch as
redisThe database has a password set: To set up a consistent
Nginxload balancing multiple Tomcatopen
nginx.conffind the upstream
nodedirectly 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.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

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

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

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]

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

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