Use LvsDR to achieve load balancing

Source: Internet
Author: User
LVS is short for LinuxVirtualServer. it is a Linux Virtual Server. to adapt to LVS, you can build a high-performance server load balancer system. LVS has three modes: LVSNAT (network address translation) LVSTUN (IP tunnel) and LVSDR (using the Lvs DR mode directly to achieve load balancing LVS is short for Linux Virtual Server, that is, Linux Virtual Server, LVS can be used to build a high-performance load balancing system. LVS has three modes: LVS/NAT (network address translation) and LVS/TUN (IP tunneling) LVS/DR (direct routing), usually in the DR mode. The following describes how to configure the DR mode. Assume that the test environment is: Virtual IP address 192.168.1.243 is used, the IP address of the scheduling machine is 192.168.1.245, and the IP addresses of the two real servers are 192.168.1.246 and 192.168.1.247, respectively. First, install the ipvsadmyum-y install ipvsadm scheduling machine on the scheduling machine to set virtual IPifconfig eth0: 0 192.168.1.243 netmask 255.255.255.255route add-host 192.168.1.243 dev eth0: 0 two real servers to set virtual IPifconfig lo: 0 192.168.1.243 netmask 255.255.255.255route add-host 192.168.1.243 dev lo: 0 true server configuration arp ignore script (several servers are configured) vi/data0/arp_ignore.sh add #! /Bin/shecho 1>/proc/sys/net/ipv4/conf/lo/arp_ignoreecho 2>/proc/sys/net/ipv4/conf/lo/arp_announceecho 1>/proc /sys/net/ipv4/conf/all/arp_ignoreecho 2>/proc/sys/net/ipv4/conf/all/arp_announce Grant executable permission chmod a + x/data0/arp_ignore.sh LVS scheduling machine configuration LVS script vi/data0/lvs. sh add #! /Bin/shipvsadm-Cipvsadm-At 192.168.1.243: 80-s rripvsadm-at 192.168.1.243: 80-r 192.168.1.246: 80-gipvsadm-at 192.168.1.243: 80-r 192.168.1.247: 80-gipvsadm-L-n grant the executable permission chmod a + x/data0/lvs. sh executes lvs on the dispatcher and each server. sh and arp_ignore.sh scripts to test the effect.

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.