Case one:
"LVS Client Node" Development LVS Client Set VIP and Admin script to suppress ARP
Script content:
#!/bin/bash############################################################### file name: lvs_ client.sh# version: v1.0# author: da ya# organization: [email protected]# created time : 2018# description:######################################## ######################. /etc/init.d/functionsvip= ' Ip a s lo|grep 10.0.0.13|wc -l ' Function start () { if [ $Vip -eq 1 ];then action ' vip is alreadly exists ' /bin/true else ip addr add 10.0.0.13/32 dev lo echo -e ' Net.ipv4.conf.all.arp_ignore = 1\nnet.ipv4.conf.all.arp_announce = 2\nnet.ipv4.conf.lo.arp _ignore = 1\nnet.ipv4.conf.lo.arp_announce = 2 ' >/etc/sysctl.conf sysctl -p &>/dev/null action ' vip is started ' /bin/true fi}function Stop () { ip addr del 10.0.0.13/32 dev lo &>/dev/null action ' Vip is delete ' /bin/true}case $1 instart) Start;; Stop) Stop;; Restart) Stop sleep 1 Start;; *) echo "PLEASE INPUT $0 { START|STOP|RESTART }";; Esac
To test:
Case TWO:
The LVS Master node simulates the keepalived Health check function to manage the LVS node,
When the node hangs (detects 2 times, interval 2 seconds) from the server pool, OK (detection 2 times, 2 seconds interval) add in
Tip: Use the IPVSADM command to add and reduce LVS nodes.
Script content:
Shell of the enterprise actual work Case 2