状态为 2 的 Keepalived 退出

问题描述 投票:0回答:1

---请删除这个问题,因为我的公司因限制而给我警告---

bash high-availability keepalived
1个回答
0
投票

如 keepalived.conf 手册页所述,它寻找

a script to be executed periodically
.

VRRP script(s)
        # Adds a script to be executed periodically. Its exit code will be
        # recorded for all VRRP instances which are monitoring it.
        vrrp_script <SCRIPT_NAME> {
           script <STRING>|<QUOTED-STRING> # path of the script to execute

所以这应该可以解决问题:

  • 将您的命令添加到脚本文件中,例如
    chk_nebula.sh
    • cat /chk_nebula.sh
#!/bin/bash
/bin/ping -c 1 172.20.128.100 &> /dev/null
  • 通过运行使脚本文件可执行:
    • chmod +x /chk_nebula.sh
  • 并在 keepalive 配置文件中为
    script
    参数使用以下值。

script "/chk_nebula.sh"

© www.soinside.com 2019 - 2024. All rights reserved.