In the LVS high load, the LB node (that is, the usual DR) has a single point of problem; Here the keepalived is used to solve the single point problem;
Look at the picture operation;
lb1:eth0:192.168.182.133 (vip:eth0:0 192.168.182.200)
lb2:eth0:192.168.182.138 (vip:eth0:0 192.168.182.200)
rs1:eth0:192.168.182.130 (vip:lo:0 192.168.182.200)
rs2:eth0:192.168.182.129 (vip:lo:0 192.168.182.200)
The LVS model is Dr;
First in two rs1, rs2 on the operation;
Echo 2 >/proc/sys/net/ipv4/conf/all/arp_announce
echo 2 >/proc/sys/net/ipv4/conf/eth0/arp_announce
echo 1 >/proc/sys/net/ipv4/conf/all/arp_ignore
echo 1 >/proc/sys/net/ipv4/conf/eth0/arp_ignore
Service Network restart
ifconfig lo:0 192.168.182.200 netmask 255.255.255.255 broadcast 182.168.182.200 Route add-host 192.168.182.200
Dev lo:0
yum Install httpd-y
echo web1 >/var/www/html/index.html #rs1标识web1
echo web2 >/var/www/html/ index.html #rs2标识web2
service httpd start
LB1, LB2 on the operation;
Yum Install Ipvsadm keepalived httpd-y
keepalived configuration file on the LB1
! Configuration File for keepalived global_defs {notification_email {coffee_lanshan@sina.com} notification_e
Mail_from root@localhost smtp_server 127.0.0.1 smtp_connect_timeout router_id lvs_1} vrrp_instance VI_1 {
State MASTER #LB2为BACKUP Interface eth0 virtual_router_id Wuyi priority #LB2为100 Advert_int 1
Authentication {Auth_type pass Auth_pass Lansgg} virtual_ipaddress {192.168.182.200
} virtual_server 192.168.182.200 {delay_loop 6 lb_algo wrr lb_kind DR nat_mask 255.255.255.0
Persistence_timeout protocol TCP real_server 192.168.182.130 {weight 2 Tcp_check {
Connect_timeout 3 nb_get_retry 3 delay_before_retry 1 connect_port 80} Sorry_server 127.0.0.1 real_server 192.168.182.129 {weight 2 Tcp_check {conn
Ect_timeout 3 Nb_get_retry 3 delay_before_retry 1 connect_port 80}}}