当前位置:网站首页>Using Tengine to solve the session problem of load balancing
Using Tengine to solve the session problem of load balancing
2022-07-03 15:06:00 【Brother Xing plays with the clouds】
It happened like this ~~, I've seen a lot of Baidu nginx Load balancing session The way the problem is , I chose to study url_hash The way . After some configuration , I feel more and more that the post found by Baidu is too old , Go to http://wiki.nginx.org/ Find this module on
, stay github I saw such a passage on the download location :
NOTE: This module is obsolete as of Nginx 1.7.2, which includes the hashdirective. This repository remains for historical interest only. My understanding is that this version is absolutely used nginx1,7,2, This library is only for historical references , Baidu translation is that this module is outdated , I can't understand .
At a time of confusion , I saw the tengine, This is Taobao right nginx An extended optimization of . Then I turned to this ~~, Found in tengine One of them is called ngx_http_upstream_session_sticky_module Module , It fits my purpose very well , He uses users cookie To keep right session Support for . The specific principle remains to be studied , In short, I have to try ~~
Please refer to this for the installation process :http://www.linuxidc.com/Linux/2015-09/123050.htm .( Point out the problem of this article , In the installation nginx When you use ./configure --prefix=/opt/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/usr/local/src/openssl-1.0.1h --with-zlib=/usr/local/src/zlib-1.2.8 --with-pcre=/usr/local/src/pcre-8.35 --with-jemalloc=/usr/local/jemalloc-3.6.0 This command )
After various stepping pits , It's done :( This interface is also respectful nginx, Still so simple . - - !)
Then let's try that magical module , The configuration is as follows :
upstream rock{ server 127.0.0.1:8081; server 127.0.0.1:8082; session_sticky; }
server { server_name www.linuxidc.com rockcoding.com; listen 80; index index.html index.htm index.jsp; location / { proxy_pass http://rock; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # access_log /data/log/rockman/www.linuxidc.com main; # Log files } }
Colleagues in the company , For the Internet ip Are all the same , As long as you visit two different platforms The server And continuous refresh will not change session It won't fail ( In fact, I won't jump to another one The server ), Then it's a success . Two computers access , Or visit different browsers , Modular based cookie To determine the ~
Um. , Than ip_hash Much better , But to compile so many things , I always feel that I need to further study , It is convenient to use this tengine Well ~
边栏推荐
- Yolov5 advanced nine target tracking example 1
- Niuke bm83 string deformation (case conversion, string inversion, string replacement)
- 4-24--4-28
- C string format (decimal point retention / decimal conversion, etc.)
- Troubleshooting method of CPU surge
- Global and Chinese markets for indoor HDTV antennas 2022-2028: Research Report on technology, participants, trends, market size and share
- Didi off the shelf! Data security is national security
- Global and Chinese market of optical fiber connectors 2022-2028: Research Report on technology, participants, trends, market size and share
- XWiki安装使用技巧
- Influxdb2 sources add data sources
猜你喜欢

Besides lying flat, what else can a 27 year old do in life?

基础SQL教程

What is one hot encoding? In pytoch, there are two ways to turn label into one hot coding
![[Yu Yue education] scientific computing and MATLAB language reference materials of Central South University](/img/83/922efb4f88843f1b7feaccf2b515b9.jpg)
[Yu Yue education] scientific computing and MATLAB language reference materials of Central South University

C string format (decimal point retention / decimal conversion, etc.)

什么是one-hot encoding?Pytorch中,将label变成one hot编码的两种方式

Vs+qt application development, set software icon icon

创业团队如何落地敏捷测试,提升质量效能?丨声网开发者创业讲堂 Vol.03

第04章_逻辑架构

什么是embedding(把物体编码为一个低维稠密向量),pytorch中nn.Embedding原理及使用
随机推荐
Composite type (custom type)
C language dup2 function
Nppexec get process return code
406. Reconstruct the queue according to height
Incluxdb2 buckets create database
There are links in the linked list. Can you walk three steps faster or slower
什么是embedding(把物体编码为一个低维稠密向量),pytorch中nn.Embedding原理及使用
Introduction to opengl4.0 tutorial computing shaders
Mmdetection learning rate and batch_ Size relationship
4-33--4-35
The latest M1 dedicated Au update Adobe audit CC 2021 Chinese direct installation version has solved the problems of M1 installation without flash back!
Yolov5 series (I) -- network visualization tool netron
"Seven weapons" in the "treasure chest" of machine learning: Zhou Zhihua leads the publication of the new book "machine learning theory guide"
Global and Chinese market of Bus HVAC systems 2022-2028: Research Report on technology, participants, trends, market size and share
Yolov5系列(一)——網絡可視化工具netron
Qt development - scrolling digital selector commonly used in embedded system
Open under vs2019 UI file QT designer flash back problem
5.2-5.3
What are the composite types of Blackhorse Clickhouse, an OLAP database recognized in the industry
第04章_逻辑架构