LVS implements DR model construction

Table of contents

1. Implement DR model construction

   1. Load scheduler configuration

        1.1 Adjust ARP parameters

1.2 Configure the virtual IP address and restart the network card

1.3 Install ipvsadm

1.4 Load ip_vs module

     1.5 Start ipvsadm service

1.6 Configure load distribution strategy

1.7 Preservation strategy

2. Web node configuration

       1.1 Adjust ARP parameters

1.2 Configure virtual IP address

1.3 Add a loopback route

 1.4 Install nginx and write files

1.5 Website View


1. Implement DR model construction


   1. Load scheduler configuration


        1.1 Adjust ARP parameters


            vim /etc/sysctl.conf
            net.ipv4.conf.all.send_redirects = 0 
net.ipv4.conf.default.send_redirects=0
net.ipv4.conf.ens33.send_redirects = 0
            sysctl -p


       

1.2 Configure the virtual IP address and restart the network card


            cd /etc/sysconfig/network-scripts/
            cp ifcfg-ens33 ifcfg-ens33:0
            systemctl restart network

 

1.3 Install ipvsadm


            yum  install -y ipvsadm
      

1.4 Load ip_vs module


            modprobe ip_vs
            lsmod |grep ip_vs
 

     1.5 Start ipvsadm service

Create the file touch /etc/sysconfig/ipvsadm
            systemctl start ipvsadm
      

1.6 Configure load distribution strategy


            ipvsadm -A -t 192.168.115.200:80 -s rr
            ipvsadm -a -t 192.168.115.200:80 -r 192.168.115.4:80 -g
            ipvsadm -a -t 192.168.115.200:80 -r 192.168.115.5:80 -g
      

1.7 Preservation strategy


            ipvsadm-save > /etc/sysconfig/ipvsadm
  

2. Web node configuration


       1.1 Adjust ARP parameters


            vim /etc/sysctl.conf


            net.ipv4.conf.all.arp_ignore=1 
net.ipv4.conf.all.arp_announce=2 
net.ipv4.conf.default.arp_ignore=1 
net.ipv4.conf.default.arp_announce = 2 
net.ipv4.conf.lo.arp_ignore = 1 
net.ipv4.conf.lo.arp_announce=2
            sysctl -p
      

 

1.2 Configure virtual IP address


            cd /etc/sysconfig/network-scripts/
            cp ifcfg-lo ifcfg-lo:0
            vim ifcfg-lo:0
        

 

1.3 Add a loopback route


            route add -host 192.168.115.200/32 dev lo:0
        

 1.4 Install nginx and write files

 

 

1.5 Website View

 

Guess you like

Origin blog.csdn.net/mengjialiang2002/article/details/132459605