The LB cluster is a shorthand for the load balance cluster, translated into Chinese. Common open source software for load balancing is
Nginx, LVS, keepalived, commercial hardware load equipment F5, Netscale.
The structure of the LB cluster, such as the principle is also very simple, that is, when the user requests come over, will be sent directly to the Distributor (Director server), and then it put the user's request based on the pre-set algorithm, intelligently distributed to the back-end of the real server (virtual server). If a different machine, the data requested by the user may not be the same, in order to avoid this situation, so the use of shared storage, so that all users request the same data.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/74/92/wKioL1YiUp6zJ29UAAEy1FsHeZQ178.jpg "title=" LB The architecture of the cluster. png "alt=" wkiol1yiup6zj29uaaey1fshezq178.jpg "/>
LVS is an open source software project that implements a load balancing cluster, and the LVS architecture can be logically divided into the dispatch layer (Director), the server set
Group layer (Real server) and shared storage. LVS is divided into the following three modes from the implementation.
(1) NAT (the scheduler changes the requested destination IP, the VIP address to the IP of the Real server, and the returned packets are also routed through the scheduler
, the scheduler then modifies the source address to the VIP).
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/74/92/wKioL1YiUrmyeaeCAAEzwHcFsEM708.jpg "title=" LB Cluster-nat.png "alt=" Wkiol1yiurmyeaecaaezwhcfsem708.jpg "/>
(2) TUN (the scheduler encrypts the requested packet encapsulation encryption over the IP tunnel to the back-end real server, while the real
The server will return the data directly to the client and not the scheduler.
(3) DR (the scheduler will change the destination MAC address of the requested packet to the MAC address of the real server, and return it without passing the scheduler, directly to the client). Reference http://www.it165.net/admin/html/201401/2248.html
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/96/wKiom1YiUqSipAt3AAFF_F2mXyA929.jpg "title=" LB Cluster-dr.png "alt=" Wkiom1yiuqsipat3aaff_f2mxya929.jpg "/>
Several IP concepts appear in the figure, which need to be explained, where DIP (driector IP) is the Ip,nat mode of the distributor it must be a public IP, to be externally serviced. The VIP (virtual IP), which is used in TUN and DR mode, needs to be configured on both the Distributor and the back-end real server. RIP (real IP) is the IP of the backend real server, in TUN and Dr Mode, RIP is the public IP. If we want to dispatch the user's request to the back-end RS, it needs to be implemented by the scheduling algorithm, so what are the scheduling algorithms for LVS?
(1) round call scheduling (Round Robin) (RR), this algorithm is the simplest, regardless of the back-end RS configuration and processing power, very
Distributed in a balanced manner.
(2) weighted round call (Weighted Round Robin) (abbreviated as WRR), more than the above algorithm a weight concept, you can set the RS
The higher the weight, the more requests are distributed, the weight range is 0-100.
(3) Minimum link (least connection) (LC), this algorithm will be based on the number of connections to the back-end RS to determine who to distribute the request, than
If the number of RS1 connections is less than the number of RS2 connections, then the request is given priority to RS1.
(4) weighted minimum link (Weighted Least Connections) (WLC) , which has a more weighted concept than the third algorithm.
Introduction to the LVS of 1.4-lb cluster