当前位置:网站首页>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 ~
边栏推荐
- 2022/02/14
- B2020 分糖果
- TPS61170QDRVRQ1
- [ue4] HISM large scale vegetation rendering solution
- NOI OPENJUDGE 1.4(15)
- Awvs batch operation script
- Troubleshooting method of CPU surge
- "Seven weapons" in the "treasure chest" of machine learning: Zhou Zhihua leads the publication of the new book "machine learning theory guide"
- 远程服务器后台挂起 nohup
- [opengl] bone animation blending effect
猜你喜欢
Yolov5系列(一)——網絡可視化工具netron
【可能是全中文网最全】pushgateway入门笔记
5-1 blocking / non blocking, synchronous / asynchronous
[graphics] hair simulation in tressfx
4-24--4-28
Devaxpress: range selection control rangecontrol uses
[Yu Yue education] scientific computing and MATLAB language reference materials of Central South University
[ue4] Niagara's indirect draw
Qt development - scrolling digital selector commonly used in embedded system
Troubleshooting method of CPU surge
随机推荐
Global and Chinese market of trimethylamine 2022-2028: Research Report on technology, participants, trends, market size and share
[ue4] cascading shadow CSM
"Seven weapons" in the "treasure chest" of machine learning: Zhou Zhihua leads the publication of the new book "machine learning theory guide"
[opengl] advanced chapter of texture - principle of flowmap
Global and Chinese market of transfer case 2022-2028: Research Report on technology, participants, trends, market size and share
Devaxpress: range selection control rangecontrol uses
运维体系的构建
Centos7 deployment sentry redis (with architecture diagram, clear and easy to understand)
Simulation of LS -al command in C language
Chapter 14 class part 1
NOI OPENJUDGE 1.5(23)
Piwigo 2.7.1 sqli learning
基于SVN分支开发模式流程浅析
[pytorch learning notes] datasets and dataloaders
使用JMeter对WebService进行压力测试
Influxdb2 sources add data sources
Déformation de la chaîne bm83 de niuke (conversion de cas, inversion de chaîne, remplacement de chaîne)
Composite type (custom type)
[transform] [NLP] first proposed transformer. The 2017 paper "attention is all you need" by Google brain team
Global and Chinese market of solder bars 2022-2028: Research Report on technology, participants, trends, market size and share