==lvs Introduction = =
1. Introduction
Slightly
2. Architecture
Load balancer,server array,shared Storage.
3.IP Load Balancing Technology
DNS polling, based on client scheduling, application-level system scheduling, IP address-based scheduling, the highest efficiency IP load balancing technology.
Vs/nat: Principle: Snat+dnat. Cons: With more and more user requests, the scheduler processing power becomes a bottleneck.
Vs/tun: Pros: Real server has no geo-location restrictions, and real server no longer has LVS in response to requests.
VS/DR: Highest performance, LVS Scheduler and real server must be on the same physical network segment.
4.LVS Advantages
High availability, high reliability
= = Install = =
Ready to work: In Dr,tun mode, Real server must bind VIP
Installation:
Check the Ipvs module of the LVS
Modprobe-l|grep Ipvs-------
Kernel/net/netfilter/ipvs/ip_vs_rr.ko
Kernel/net/netfilter/ipvs/ip_vs_wrr.ko
Installing the Management software Ipvsadm
Http://www.linuxvirtualserver.org/software/ipvs.html
IPVSADM Management
Ipvsadm-a-T 192.168.60.200:80-s rr-p #添加一条虚拟服务, scheduling policy for polling scheduling, time-out 600 seconds
Ipvsadm-a-T 192.168.60.200:80-r 192.168.60.132:80–g #向对应的虚拟服务下面添加一条real SERVER-G=DR
==lvs Configuration = =
LVS Scheduler Configures virtual IP
#ifconfig eth0:0 192.168.60.200 broadcast 192.168.60.200 netmask 255.255.255.255 up
Here a virtual device eth0:0 is bound on the eth0 device, Also set a virtual IP is 192.168.60.200, that is, the IP address we planned above, and then specify the broadcast address is also 192.168.60.200, it is important to note that the subnet mask here is 255.255.255.255
#route add-host 192.168.60.200 Dev eth0:0
Assigning a route to a device eth0:0
#echo "1" >/proc/sys/net/ipv4/ip_forward
Turn on routing ip forwarding, in DR Mode, it is not necessary to turn on the packet forwarding function of the system, while in NAT mode this operation is required
==lvs mode = =
1.DR mode
The DR mode is the most efficient one, for each request LVS changes the purpose Mac to the Mac of the selected machine from RS, and then the modified data frame in the service
Sent on the local area network of the device group. But the limitation is that the LVS machine needs and RS can have at least one NIC under the same VLAN, which limits the DR Mode to only
Used in a more single network topology.
2.TUN mode
Tun mode in fact, compared with the DR Mode, the performance of the Tun mode will be dynamically selected from the RS list of a server, the request message encapsulated in another
IP packets, and then forwards the encapsulated IP packets to the selected server, and the RS server receives the message, the message is first unpacked to obtain the original target address of the VIP
Message, the server discovers that the VIP address is configured on the local IP tunneling device, so it processes the request and then returns the response message directly to the
Customer. The Tun mode can solve the problem that the DR mode cannot break the network segment, even can break the public network. However, RS is required to support the IPIP module.
3.NAT mode
Nat mode has no other requirements for RS, the only requirement is to set the RS gateway to the LVS machine. Because of the flow of incoming and outgoing through the LVS machine, so the sex
Can be relatively poor, and the size of the deployment is difficult to enlarge.
Dr Mode. vs Nat Mode. Vs Tun Mode.
1.NAT mode requires routing forwarding, and DR and Tun modes are not required.
2.DR and Tun mode back end machines need to be configured Vip,nat mode is not required.
3.NAT mode proxy request/Reply packet, DR and Tun Mode agent request package.
4.DR mode is the most efficient, followed by Tun,nat.
5.NAT mode requires that the RS machine gateway is set to LVS machine IP,DR and Tun is not required.
6 Dr mode requires back-end machines on the same network, NAT and Tun are not required.
7.NAT requires the LVS agent front and back in different network segments.
This article from the "Operation and maintenance of the road" blog, declined to reprint!
LVS Data Collation One