Introduction to LVS Clusters

Source: Internet
Author: User

LVS cluster: Open source free, high availability, high stability, high reliability

High availability: LVS load Balancer cluster has a high processing power, a node in the real server group has problems, does not affect the entire cluster of normal work, and has a high load of service capacity, can support millions of concurrent connections

Disadvantage: A single point of failure on LB, if only one lb machine, although the load of LB machine is not very high, but once the problem of the entire cluster will no longer work properly; the solution to this problem is: To do a hot standby machine (dual standby), the LB machine, under normal conditions, When there is a problem with the LB machine by the hot standby to take over, continue to work (spare lb machine through the heartbeat heartbeat monitoring the running state of the main lb machine, when the main lb machine problems, spare lb machine will take over the main lb machine VIP and service continue to work)

Heartbeat: Mainly used in the main spare lb machine, to achieve heartbeat detection and resource takeover



Composition of LVs: front lb load balancer, backend real server, and devices that share storage data



LB Load Balancer: Located at the forefront of the entire cluster, LVS Core module Ipvs is installed on the LB machine, LB machine similar to a router, there is a routing table, through this routing table to the user's request to the real server, A monitoring module Ldirectord (included in the heartbeat package) is also installed on the LB machine to monitor the health of the real server, and if a real server is having problems, it is removed from the cluster. Return to normal before joining the cluster

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5A/19/wKioL1T2p_yQ_YbfAAJy4BMisxc939.jpg "title=" Qq20150304142901.png "alt=" Wkiol1t2p_yq_ybfaajy4bmisxc939.jpg "/>



There are several load balancing methods: DNS-based, load balancing by polling a record of domain name resolution, and IP-based load balancing technology. LVS uses IP-based load balancing technology



IP load Balancing technology: is achieved through the Ipvs module, Ipvs module installed on the LB load machine, on the LB load machine virtual out of an IP, and VIP, customer access is the time to access the VIP, and then by the load scheduler through some scheduling algorithm to select a real server, Hand over the client's request to the selected real server

IPVS: is the kernel software of the LVS cluster system, which is used to distribute the user's request to the real server and the real server after the user request arrives at the load scheduler, how to return the data to the user after processing the request.



Scheduling algorithm: Polling scheduling: The user's request is given equal to each real server, so there is a problem is that if the real server performance is not the same, there will be high performance machine processing requests are idle, low performance machine processing requests slow busy state

Weight: Different weights are assigned according to real server performance, high-performance weights, processing requests, low-performance weight, less processing requests

Minimum number of connections: Allocate requests based on how many connections the real server has, and the number of connections takes precedence over the client's requests for similar performance per real server



There are three ways that Ipvs in a cluster implement load: NAT (network address translation), DR (direct route), TUN (tunnel)



Nat mode: When the user accesses the VIP on the LB machine, when the request arrives at the load scheduler, the scheduler overwrites the destination IP and port (that is, the VIP address and port number) to the selected real server's IP and port number, and then gives the request to the selected real Server,real The server after processing the request to the LB machine, and then the scheduler to the real server IP and port to the VIP address and port, and finally to the user, this way access request and return data will go through the LB machine, so lb opportunity has great pressure, prone to bottlenecks


Dr Mode: Real server no longer passes the LB machine when returning data, but directly returns the data to the user (so not only set the VIP on the LB machine, but also configure Vip,real server to return the data directly to the user after processing the user's request on each real server. After the user receives the request data, it discovers that the source IP (VIP on real server) is the destination IP address of the data request that was sent before, and accepts the data request.

VIP on Real server: is bound on the Lo interface: Ifconfig lo:0 118.192.64.120 broadcast 118.192.64.120 netmask 255.255.255.255 up



650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5A/1E/wKiom1T2uqSCLjwJAARm8fqEVPo239.jpg "title=" Qq20150304155416.png "alt=" Wkiom1t2uqscljwjaarm8fqevpo239.jpg "/>








General Description:

LB Load Balancer cluster: Only one lb load balancer

LB load Balancing cluster for HA (high availability): Dual-Machine hot standby for LB machines


LB load Balancer cluster has high availability, high stability, high reliability, there are three ways to implement cluster load: NAT (network address translation), Dr (direct route), TUN (tunnel), the most commonly used Dr Direct routing method, when the user accesses the VIP of LB machine, the request arrives at the load scheduler, The load scheduler selects a real server through a scheduling algorithm, handing the client's request to the selected real Server,real server to return the data directly to the user after processing the request, no longer passing the LB machine, which requires the VIP to be bound on the real server, This VIP is bound to the Lo interface, the LO is a roundabout address, only for local testing, do not carry out inter-network data transmission; We need to install the Ipvs module on the LB machine for load balancing, and how to distribute the user's request to the real when the user requests reach the load scheduler How the server and real server return data to the user after processing the request, and we also need to install heartbeat on the LB machine and use a plug-in Ldirectord of heartbeat to monitor the health of the real server. If a real server problems, then remove from the cluster, restore normal and then join the cluster; In this case there is only one lb machine, a single point of failure on LB, if only one lb machine, although the load of LB machine is not very high, but once the problem of the entire cluster will no longer work properly, So we can do a two-machine hot spare lb machine, through just installed heartbeat heartbeat monitoring lb machine running state, when the main lb machine problems, spare lb machine will take over the main lb machine VIP and service continue to work, so as to achieve high availability



This article is from the "See" blog, please be sure to keep this source http://732233048.blog.51cto.com/9323668/1617201

Introduction to LVS Clusters

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.