查看/var/log/messages keepalived相关日志,查看提示,是否没有权限,script_security not enabled
1、确认脚本可以手动执行,是否有执行权限,脚本第一句需要加#!/bin/bash
2、keepalived配置文件是否省略了global_defs {},本地测试省去这段脚本不会执行,
加上后虽然还提示SECURITY VIOLATION - scripts are being executed but script_security not enabled.
但是脚本执行了,查看/var/log/messages 可看到 VRRP_Script(chk_mysql) succeeded
参考:
https://github.com/acassen/keepalived/issues/901