使用ldirectord进行LVS健康性检查

  1. 安装
curl -O https://download-ib01.fedoraproject.org/pub/fedora/linux/updates/30/Everything/x86_64/Packages/l/ldirectord-4.4.0-1.fc30.x86_64.rpm

yum install ldirectord-4.4.0-1.fc30.x86_64.rpm
  1. 准备配置文件
cp /usr/share/doc/ldirectord/ldirectord.cf /etc/ha.d/
vim /etc/ha.d/ldirectord.cf
# Global Directives
checktimeout=3
checkinterval=1
fallback=127.0.0.1:80
#fallback6=[::1]:80
autoreload=yes
logfile="/var/log/ldirectord.log"
logfile="local0"
#emailalert="[email protected]"
#emailalertfreq=3600
#emailalertstatus=all
quiescent=no        # yes, 故障server只是设置成权重为0

# Sample for an http virtual service
virtual=10.0.0.100:80
        servicename=Web Site
        comment=Test load balanced web site
        real=192.168.80.13:80 gate
        real=192.168.80.14:80 gate
        fallback=127.0.0.1:80 gate
        service=http
        scheduler=rr
        #persistent=600
        #netmask=255.255.255.255
        protocol=tcp
        checktype=negotiate
        checkport=80
        request="index.html"


  1. 准备sorry server on LVS
yum install httpd
echo 'Sorry, the service is down temporally' > /var/www/htmp/index.html
systemctl start httpd

你可能感兴趣的:(使用ldirectord进行LVS健康性检查)