In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you about the principle and structure of lvs, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
I. concept
The terminology of lvs:
Router:GWIP
Vs:virtual server,director
Rs:real server
CIP:client IP
VIP:virtual server IP
DIP:ditecter IP (connect with rs)
RIP:real server IP
The IP requested by the user must be VIP, otherwise vs will lose the scheduling meaning of load balancing
LVS cluster can be divided into two parts structurally: the front-end load balancer (called director) and the back-end real server (called real server). The director at the front end of cluster dispatches requests from the outside to different real server at the back end of cluster for execution. Real server is responsible for providing all kinds of application services, such as Web, FTP, Mail and so on. The quantity of real server can be increased or decreased according to the actual demand.
II. The working process of lvs
III. Types of lvs
There are three general standard models for lvs
(1) lvs-nat (Network address Mapping)
(2) lvs-dr (Direct routing)
(3) lvs-tun (IP Tunnel)
3.1. the characteristics of LVS NAT (essentially a multi-objective DNAT):
1. RS should use a private address
2. The gateway of RS must point to DIP
3. RIP and DIP must be in the same network segment.
4. Both request and response messages have to go through Director;. In high-load scenarios, Director is likely to become the bottleneck of system performance.
5. Support port mapping
6. RS can use any OS that supports cluster services.
3.2.The characteristics of LVS DR type:
1. RS can use a private address, but it can also use a public network address. At this time, you can directly connect to the RS through the Internet to realize configuration, monitoring, etc.
2. The gateway of RS must not point to DIP.
3. RS and Dirctory should be in the same physical network (cannot be separated by routers, because VS encapsulates MAC addresses to RS)
4. The request message goes through Directory, but the response message does not go through Director.
5. Port mapping is not supported
6. RS can use most operating systems
Because the VIP of VS and RS is the same in DR type, if address conflicts occur within the same network segment, there are three ways to resolve address conflicts:
Prevent RS from responding to ARP broadcast requests to VIP:
1. Implement the binding of static MAC address VIP on the front-end route
Prerequisite: must have the configuration permission of the router
Cons: this binding cannot be updated when Directory fails over
2 、 arptables
Premise: install arptables program in each RS and write arptables rules
Cons: applications that rely on unique features
3. Modify Linux kernel parameters
Premise: RS must be Linux
Disadvantages: poor applicability
Two parameters:
Arp_announce: define advertisement mode
Arp_ignore: defines the response mode when an arp request is received
Configure a private route so that the response message first passes through the alias interface on the lo configured by vip
Lvs-dr: the workflow is shown in the figure
3.2.The lvs-tun:IP tunnel
1. RIP, DIP and VIP must all be public network addresses
2. The gateway of RS will not and cannot point to DIP.
3. The request message goes through Directory, but the response message does not go through Director.
4. Port mapping is not supported
5. The OS of RS must support tunnel function.
Lvs-tun: workflow is shown in figure: it is also a lvs-dr-based model, except that rs and vs do not have to be on the same physical network (to achieve physical redundancy), but use tunneling technology to communicate between vs and rs.
Lvs Ten scheduling algorithms: rr, wrr, lc, wlc, lblc, lblcr, dh, sh, sed, nq
1. Round-robin scheduling (Round Robin) (rr for short)
two。 Weighted rotation (Weighted Round Robin) (wrr for short)
3. Minimum link (Least Connections) (LC)
4. Weighted minimum links (Weighted Least Connections) (WLC)
5. Locality-based minimum links (Locality-Based Least Connections) (LBLC)
6. Locality-based minimum links (Locality-Based Least Connections with Replication) with replication (LBLCR)
7. Destination address hash (Destination Hashing) (DH)
8. Source address hash (Source Hashing) (SH)
9. Shortest expected delay (Shortest Expected Delay Scheduling SED) (SED)
10. Minimum queue scheduling (Never Queue Scheduling NQ) (NQ)
The two most commonly used algorithms are introduced:
two。 Weighted rotation (Weighted Round Robin) (wrr for short)
The scheduler schedules access requests according to the different processing capacity of the real server through the "weighted round call" scheduling algorithm. This ensures that powerful servers can handle more access traffic. The scheduler can automatically inquire about the load of the real server and adjust its weight dynamically.
4. Weighted minimum links (Weighted Least Connections) (WLC)
When the performance of the servers in the cluster system varies greatly, the scheduler uses the "weighted least link" scheduling algorithm to optimize the load balancing performance, and the servers with higher weights will bear a larger proportion of the active connection load. The scheduler can automatically inquire about the load of the real server and adjust its weight dynamically.
The above is how the principle and structure of lvs is, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.