当前位置:网站首页>LVS four layer load balancing cluster (6) LVS working mode
LVS four layer load balancing cluster (6) LVS working mode
2022-06-13 03:36:00 【51CTO】
NAT Forwarding mode
Network Address Translation, Network address translation

- CIP: client IP Address / Initiator / Source IP Address
- VIP: fictitious IP/lvs colony IP
- RIP: Real server IP/WEB colony IP/web The server
working principle
①. The client sends the request to the load balancer at the forward end , The requested source address is CIP( client IP), Hereinafter collectively referred to as CIP), The target address is VIP( Load balancer front end address , Hereinafter collectively referred to as VIP).
②. The load balancer receives the message , The requested address is found in the rule , Then it will the target of the client request message IP Change the address to that of the back-end server RIP Address and send the message according to the algorithm .
③. The message is sent to Real Server after , Since the destination address of the message is itself , So it will respond to the request , And return the response message to LVS.
④. then lvs Modify the source address of this message to the local machine and send it to the client .
Pay attention to NAT In the pattern ,Real Server The gateway of must point to LVS, Otherwise, the message cannot be delivered to the client
advantage
Network isolation is more secure
save IP Address
shortcoming
director It is likely to become a bottleneck of system performance , All requests director All need to process the response
DR Direct routing mode

working principle
①. The client sends the request to the load balancer at the forward end , The requested source address is CIP, The target address is VIP.
②. The load balancer receives the message , The requested address is found in the rule , Then it will request the source of the message from the client MAC Change the address to yourself DIP Of MAC Address , The goal is MAC Change it to RIP Of MAC Address , And send the package to RS.
③.RS Find the purpose in the request message MAC Is your own , Will receive this message , After processing the request message , Pass the response message lo Interface to eth0 The network card is sent directly to the client .
characteristic
- Cluster nodes and director Must be within a physical network
- RIP You can use public or private addresses
- director Only inbound requests are processed ,director The pressure on the server is relatively small
- Cluster node gateway does not point to director, Therefore, the exit does not pass director
- Port mapping is not supported
- Most operating systems can be used as realserver, Support isolation arp radio broadcast
ARP problem
Usually ,DR The pattern needs to be in Real-server On the configuration VIP, The configuration method is :
/sbin/ifconfig lo:0 inet VIP netmask 255.255.255.255
i) The reason lies in , When LVS hold client Forward the packet of to Real-server when , Because the purpose of the package IP The address is VIP, So if Real-server After receiving this bag , The purpose of the discovery package IP Not your own system IP, Then you will think that this package was not sent to you , Will discard this bag , So you need to put this IP The address is bound to the network card ; When sending a reply packet to client when ,Real-server The source and destination addresses of the packets will be swapped , Reply directly to client.
ii) About ARP radio broadcast :
* Bound above VIP The mask of is ”255.255.255.255″, Explain that the broadcast address is itself , Then he will not ARP It is sent to the actual broadcast domain to which it belongs , This prevents LVS On VIP Conflict , And lead to IP Conflict .
* In addition to Linux Of Real-server On , Need to set up ARP Of sysctl Options :
TUN-IP Tunnel model

working principle
①. The client sends the request to the load balancer at the forward end , The requested source address is CIP, The target address is VIP.
②. The load balancer receives the message , The requested address is found in the rule , It then encapsulates another layer at the beginning of the client request message IP message , Change the source address to DIP, Target address changed to RIP, And send the package to RS.
③.RS After receiving the request message , The first layer of packaging is broken down , And then there's another layer IP The target address of the header is itself lo On the interface VIP, So it's going to process the sub-request packet , And pass the response message lo Interface to eth0 The network card is sent directly to the client .
characteristic
advantage :
The load balancer is only responsible for distributing the request package to the back-end node server , and RS Send the response package directly to the user . therefore , Reduce the large data flow of load balancer , Load balancer is no longer the bottleneck of the system , Can handle a huge amount of requests , This way, , A load balancer can be a lot of RS distributed . And running on the public network can be distributed in different regions .
shortcoming :
Tunnel mode RS Nodes need to be legal IP, This approach requires all server support ”IP Tunneling”(IP Encapsulation) agreement , The server may be limited to a few Linux On the system .
Pattern contrast

FULL-NAT
Full-NAT Hence the raw , The solution is LVS and RS Span VLAN The problem of , And cross VLAN After the problem is solved ,LVS and RS No longer exist VLAN The subordination on the Internet , You can do multiple LVS Corresponding multiple RS, Solve the problem of horizontal expansion .

边栏推荐
- Doris creates OLAP, mysql, and broker tables
- ONNX+TensorRT+YoloV5:基于trt+onnx得yolov5部署1
- Onnx+tensorrt+yolov5: yolov5 deployment based on trt+onnx 1
- Doris data backup and recovery
- [synchronization function] version 2.0.16-19 has the update of synchronization function repair, but the problem has not been solved
- 2000-2019 enterprise registration data of provinces, cities and counties in China (including longitude and latitude, number of registrations and other multi indicator information)
- Figure data * reconstruction subgraph
- This article takes you to learn DDD, basic introduction
- [JVM series 8] overview of JVM knowledge points
- MySQL learning summary Xi: detailed explanation of the use of stored procedures and stored functions
猜你喜欢

Complex network analysis capability based on graph database

Parallel one degree relation query
![[azure data platform] ETL tool (5) -- use azure data factory data stream to convert data](/img/5c/79319a73881b645edaca77990f68a8.jpg)
[azure data platform] ETL tool (5) -- use azure data factory data stream to convert data

Panel for measuring innovation efficiency of 31 provinces in China (using Malmquist method)

MySQL learning summary Xi: detailed explanation of the use of stored procedures and stored functions
![[azure data platform] ETL tool (1) -- Introduction to azure data factory](/img/0c/cd054c65aee6db5ae690f104db58a3.jpg)
[azure data platform] ETL tool (1) -- Introduction to azure data factory

Spark kernel (execution principle) environment preparation /spark job submission process

MASA Auth - SSO与Identity设计

2000-2019 enterprise registration data of all provinces, cities and counties in China (including longitude and latitude, registration number and other multi indicator information)

视频播放屡破1000W+,在快手如何利用二次元打造爆款
随机推荐
C language programming -- input a string (including letters, numbers, punctuation marks, and space characters) from the keyboard, calculate the actual number of characters and print out, that is, it d
ip地址及分类
MySQL learning summary XIII: detailed explanation of if, case, loop, while & cursor of process control
Nuggets new oil: financial knowledge map data modeling and actual sharing
基于华为云物联网设计的浇花神器(STM32+ESP8266)
Part II. S3. intuitionistic fuzzy multi-attribute decision-making method when attribute weight is intuitionistic fuzzy number
LeetCode 178. Score ranking (MySQL)
English grammar_ Mode adverb position
Panel data set of rural cities and towns: per capita consumption and expenditure of prefecture level cities 2012-2019 & rural data of provinces 2013-2019
LVS四层负载均衡集群(5)LVS概述
How to Draw Useful Technical Architecture Diagrams
Coal industry database - coal price, consumption, power generation & Provincial Civil and industrial power consumption data
Several functions in YAF framework controller
Understanding the ongdb open source map data foundation from the development of MariaDB
Prefecture level city - air flow coefficient data - updated to 2019 (including 10m wind speed, boundary height, etc.)
Yolov5 face+tensorrt: deployment based on win10+tensorrt8.2+vs2019
Quickly obtain the attributes of the sub graph root node
Spark core concepts: Master, worker, driver program, executor, RDDS
look on? What is the case between neo4j and ongdb?
Common command records of redis client