LVS Health Detection Script

Source: Internet
Author: User


LVS Health Detection Script


Writing is not good, basic realization, because the basic will not be used, there is time to improve, hehe


1 #!/bin/bash

2

3 rs= (' 192.168.61.130 ' 192.168.61.132 ')

4 vip= "192.168.61.100"

5 dip= "192.168.61.131"

6 Checkcount=1

7 checkloop=4

8 I=1

9

10

One while [$i-lt 2];d o

#sorry server detection, Director httpd default boot

If [$ (ipvsadm-ln |grep "\->" |wc-l)-lt 2];then

Ipvsadm-a-T $VIP ": $"-R $dip-G

All else

ipvsadm-d-T $vip ": Up"-R $dip-G

+ fi

18

#循环所有RS检测

Rs_x in ${rs[@]};d o

#只要在线并且之前已经下线的, on-line processing

If Curl--connect-timeout 2-s "/http" $rs _x "/index.html" &>/dev/null;then

Ipvsadm-ln |grep $rs _x &>/dev/null

If [$?-ne 0];then

Ipvsadm-a-T $vip ": Up"-R $rs _x &>/dev/null

#echo "Add Rs1 server OK"

+ fi

-Else

#当RS是刚离线的, every 1 seconds detection, detection 3 times is not online on the offline, if it is not done before the offline processing

Ipvsadm-ln |grep $rs _x &>/dev/null

If [$?-eq 0];then

[$checkcount-le $checkloop];d o

If Curl--connect-timeout 1-s "/http" $rs _x "index.html" &>/dev/null;then

Break

+ Else

checkcount++

Panax Notoginseng fi

If [$checkcount-eq 3];then

If Ipvsadm-ln |grep $rs _x &>/dev/null;then

ipvsadm-d-T $vip ": Up"-R $rs _x &>/dev/null

#echo "del rs1 server OK"

Break

+ fi

-Fi

1 sleep

Done

Checkcount=1

-Fi

49

Fi

Wuyi Done

52

3 Sleep

Wu Done


LVS Health Detection Script

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.