V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
hezhiming1993
V2EX  ›  问与答

keepalived 的 check shell 脚本中, 为什么要将 keepalived 停止掉?

  •  
  •   hezhiming1993 · Jul 19, 2023 · 461 views
    This topic created in 1017 days ago, the information mentioned may be changed or developed.

    [上下文环境]

    比如这个 mysql_check.sh 的内容

    #!/bin/bash
    
    . /root/.bash_profile
    
    count=1
    while true
    do
    mysql -uroot -p123456 -e "show status;" > /dev/null 2>&1
    i=$?
    ps aux | grep mysqld | grep -v grep > /dev/null 2>&1
    j=$?
    if [ $i = 0 ] && [ $j = 0 ]
    then
       exit 0
    else
       if [ $i = 1 ] && [ $j = 0 ]
       then
           exit 0
       else
            if [ $count -gt 10 ]
            then
                  break
            fi
       let count++
       continue
       fi
    fi
    done
    
    
    
    systemctl stop keepalived
    #pkill -9 keepalived
    

    [问题]

    1. 如果 mysqld 因为一些原因, down 掉,然后起来了, 这个中间过程 keepalived 停止了, 那就相当于(逻辑上)这台 keepalived 的节点 down 了( 实际上节点运行正常), 后续也无法参与 VIP 的漂移了
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   786 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 20:40 · PVG 04:40 · LAX 13:40 · JFK 16:40
    ♥ Do have faith in what you're doing.