LVS Cluster
First, Load Balancing implementation classification:
(a) Hardware: The cost will be very high
- F5,big IP
- Citrix,netscaler
- A10
(ii) Software: Low cost, fast implementation.
Four tiers (routing devices distributed to different devices):
Lvs
Level Seven:
Nginx (limited seven-layer protocol)
Implementation: Http,smtp,pop3,imap
Haproxy
Implementation: HTTP,TCP (MYSQL,SMTP)
Four-tier load balancing and seven-layer load balancing are different:
1, four layer only auxiliary parsing three layer and four layer protocol, the specific content it will not do processing. It is better to not parse higher-level protocol performance, but the advanced features do not (load balancer based on user's characteristics such as: URL requested in Web server)
2, seven layer reverse proxy load balancer device, for some specific protocol to provide, so it can go to the precise dissection of its corresponding protocol, and can be modified on the basis of this protocol, load-balanced backwards, all in the front-end can be achieved processing. Operation is more powerful, but performance is slightly lower than four levels.
3, the provision of solutions, according to their own project requirements and requirements to develop programs.
Two, LVS virtual server
1, Concept: LVS is a load balancing device. You do not provide services by accepting user requests and then forwarding them to back-end servers.
2, LVS working principle:
Analytical:
2.1, the LVS forwarding
The retransmission of the LVS cluster device is confirmed by the user accessing its ip+ port, and the rear server is the one that needs to be monitored to access the port.
For example: Web services are 80 and 433, then the rear server (A,B,C) will listen to this two port.
(i) Scheduling algorithm: Pick a back-end server to receive a user's new request for the computer system.
Computer system: According to the user request when the ip+ port, to determine whether to forward and forwarded to where.
2.1, 3 types of LVS (IP network conversion):
Overall process:
(a) Lvs-naT (address translation, enterprise generally will not use)
The Basic Law:
1, (RIP) cluster node must be with the dip in the same IP network;
2, RIP is usually a private address, only for the communication between the cluster nodes;
3. Dip is located between CIP and RIP, and is responsible for handling all incoming and outgoing communications;
4, RIP must point the gateway to dip;
5, support port mapping, and VIP service port can be different from RIP port;
6, RIP can be any OS;
7, in larger-scale applications, dip easily become a system bottleneck.
(ii) LVS-DR (direct routing)
The Basic Law:
1, the cluster node and dip must be in the same physical network (one or several switches);
2, the RIP address can be a private address or public network address;
Public IP Benefits: if Vip/dip hangs, CIP can access Vip/rip directly.
3, Dip is only responsible for processing inbound requests, response messages are sent directly to the client by RIP;
4, cluster node RIP can not point the gateway to dip;
5, port mapping is not supported;
6, RIP can be the majority of systems (VIP must be hidden);
7, LVS-DR than Lvs-nat support more rip;
(iii) Lvs-tun (tunnel)
The Basic Law:
1, cluster nodes can cross the Internet;
2, RIP must be a public network address;
3, the DIP is only responsible for processing inbound requests, response messages are directly sent to the client rip;
4, RIP network management can not point to dip;
5, only the tunnel-enabled OS can be used for RIP;
6, port mapping is not supported;
Three, the LVS Note:
1, iptables can not be used with LVS.
Due to iptables segment implementation:
Iptables Write rules/netfilter Check rules to achieve, LVS violates the iptales rules.
2. LVS segment:
IPVSADM: command-line tools for managing cluster services
Ipvs: Kernel (Implementation monitoring), in the linux2.6 after the kernel has Ipvs this mechanism.
Load-balanced LVS cluster