你好,我的保养品有问题。
在日志中,据说check脚本退出状态2,而
这是原木
Nov 11 19:54:03 MCX-G2 Keepalived_vrrp[15201]: VRRP_Script(chk_server) failed (exited with status 2)
Nov 11 19:54:03 MCX-G2 Keepalived_vrrp[15201]: VRRP_Script(chk_script) succeeded
Nov 11 19:54:03 MCX-G2 Keepalived_vrrp[15201]: (VRRP1) Entering BACKUP STATE下面是保存配置的一部分
vrrp_script chk_server {
script "/bin/ping -c 1 100.100.100.1 &> /dev/null"
interval 10 # check every 10 seconds
fall 1 # require 1 failures for KO
rise 1 # require 1 successes for OK
}而平安是成功的:
root@MCX-G2 /bin # /bin/ping -c 1 172.20.128.100
PING 172.20.128.100 (172.20.128.100) 56(84) bytes of data.
64 bytes from 172.20.128.100: icmp_seq=1 ttl=63 time=0.319 ms
--- 172.20.128.100 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.319/0.319/0.319/0.000 ms
root@MCX-G2 /bin #我没看到任何可疑的错误配置之类的东西。还有什么需要我检查的吗?
发布于 2022-11-13 11:52:34
正如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使脚本文件可执行:
中为script参数使用以下值
script "/chk_nebula.sh"
https://stackoverflow.com/questions/74407565
复制相似问题