当前位置:网站首页>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 ~
边栏推荐
- Tencent internship interview sorting
- [opengl] bone animation blending effect
- Joomla! CMS 3.0~3.4.6 RCE
- [graphics] adaptive shadow map
- Using TCL (tool command language) to manage Tornado (for VxWorks) can start the project
- Devaxpress: range selection control rangecontrol uses
- XWiki安装使用技巧
- What is one hot encoding? In pytoch, there are two ways to turn label into one hot coding
- Yolov5系列(一)——网络可视化工具netron
- Yolov5 advanced nine target tracking example 1
猜你喜欢

Vs+qt application development, set software icon icon

Devaxpress: range selection control rangecontrol uses

Série yolov5 (i) - - netron, un outil de visualisation de réseau

C # realizes the login interface, and the password asterisk is displayed (hide the input password)

What is embedding (encoding an object into a low dimensional dense vector), NN in pytorch Principle and application of embedding

Zero copy underlying analysis

Functional modules and application scenarios covered by the productization of user portraits

【注意力机制】【首篇ViT】DETR,End-to-End Object Detection with Transformers网络的主要组成是CNN和Transformer

How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03
![[attention mechanism] [first vit] Detr, end to end object detection with transformers the main components of the network are CNN and transformer](/img/9b/6ca8375ef8689a80d437665909ae30.png)
[attention mechanism] [first vit] Detr, end to end object detection with transformers the main components of the network are CNN and transformer
随机推荐
2022/02/14
Yolov5 series (I) -- network visualization tool netron
B2020 分糖果
什么是one-hot encoding?Pytorch中,将label变成one hot编码的两种方式
ASTC texture compression (adaptive scalable texture compression)
【Transform】【实践】使用Pytorch的torch.nn.MultiheadAttention来实现self-attention
Didi off the shelf! Data security is national security
解决pushgateway数据多次推送会覆盖的问题
Global and Chinese markets for transparent OLED displays 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese market of solder bars 2022-2028: Research Report on technology, participants, trends, market size and share
[opengl] pre bake using computational shaders
My QT learning path -- how qdatetimeedit is empty
NOI OPENJUDGE 1.4(15)
Yolov5 advanced nine target tracking example 1
创业团队如何落地敏捷测试,提升质量效能?丨声网开发者创业讲堂 Vol.03
Global and Chinese markets for infrared solutions (for industrial, civil, national defense and security applications) 2022-2028: Research Report on technology, participants, trends, market size and sh
Devaxpress: range selection control rangecontrol uses
What is label encoding? How to distinguish and use one hot encoding and label encoding?
在MapReduce中利用MultipleOutputs输出多个文件
Nppexec get process return code