LVS + Keepalived built notebook

Machine: amdha01 ~ node04
amdha01, before emptying lvs configuration information:

ipvsadm -C
ifconfig eth0:8 down

node01, node04, installation keepalived:

yum install keepalived ipvsadm -y
cd  /etc/keepalived/
#备份
cp keepalived.conf keepalived.conf.bak
vi keepalived.conf

Modified keepalived.conf file vrrp (Virtual Router Redundancy Protocol):

{VI_1 vrrp_instance 
    State the MASTER // node04 for the BACKUP
     interface eth0 # card 
    virtual_router_id 51 is 
    priority 100    // node04 the number 50 to less than 100 or other 
    advert_int. 1 
    authentication { 
      AUTH_TYPE the PASS 
      AUTH_PASS 1111 
    } 
    virtual_ipaddress { 
      192.168.150.100/24 dev eth0 eth0 label: 3 
     # configure here ipvsadm -A similar articles on the configuration of virtual sub-network adapter IP, subnet mask
} }

 virtual_server 192.168.150.100 80 {
  delay_loop 6
  lb_algo rr
  lb_kind DR
  nat_mask 255.255.255.0
  persistence_timeout 0
  protocol TCP

 
 

  real_server 192.168.150.12 80 {
    weight 1
    HTTP_GET {
      url {
        path /
        status_code 200
      }
      connect_timeout 3
      nb_get_retry 3
      delay_before_retry 3
    }
  }


  real_server 192.168.150.13 80 {
    weight 1
    HTTP_GET {
    url {
      path /
      status_code 200
    }
    connect_timeout 3
    nb_get_retry 3
    delay_before_retry 3
    }
  }

 }

 

 

Guess you like

Origin www.cnblogs.com/wangfajun/p/12120069.html