Linux企业实战-----LVS+keepalived负载均衡集群

用LVS实现负载均衡

实现步骤:

    #若在虚拟环境中需执行此步骤创建两个新的虚拟机,VMWARE可忽略此步骤
     
   真实主机:
              cd /var/lib/libvirt/images/
          ls
          qemu-img create -f qcow2 -b rhel7.6.qcow2 server3
          qemu-img create -f qcow2 -b rhel7.6.qcow2 server4
server1:
      pcs cluster disable --all
      pcs cluster stop --all
      systemctl status pcsd
      systemctl disable --now pcsd
      ssh server2 disable --now pcsd
      ssh server2 systemctl disable --now pcsd

Linux企业实战-----LVS+keepalived负载均衡集群_第1张图片


  server3:
          hostnamectl set-hostname server3
          cd /etc/yum.repos.d/
          vim dvd.repo
          yum install httpd
          systemctl enable --now httpd
          systemctl start httpd
          cd /var/www/html/
          echo vm3> index.html
          ip addr add 172.25.19.100/24 dev eth0
          yum install -y arptables
          arptables -A INPUT -d 172.25.19.100 -j DROP
          arptables -A OUTPUT -s 172.25.19.100 -j mangle --mangle-ip-s 172.25.19.3

Linux企业实战-----LVS+keepalived负载均衡集群_第2张图片

   server4:
          hostnamectl set-hostname server4
          cd /etc/yum.repos.d/
          vim dvd.repo
          yum install http

你可能感兴趣的:(linux,负载均衡,运维)