Shell of the enterprise actual work Case 2

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.