keepalived无法执行检测脚本报错

当关闭nginx,不会漂移VIP,keepalived只在进程被关闭,宕机,网络中断才会漂移VIP,所以写了个脚本,放到keepalived中执行,发现无法执行脚本,提示如下报错

Keepalived_vrrp: Registering gratuitous ARP shared channel
Keepalived_vrrp: Opening file '/etc/keepalived/keepalived.conf'
Keepalived_vrrp: WARNING - default user 'keepalived_script' for script execution does not exist - please create.
Keepalived_vrrp: Truncating auth_pass to 8 characters
Keepalived_vrrp: Unable to access script curl
Keepalived_vrrp: Disabling track script Check.keepalived since not found
Keepalived_vrrp: VRRP_Instance(VI_1) removing protocol VIPs.

解决办法:

配置文件/etc/keepalived/keepalived.conf添加运行健康检查脚本的用户或者组即可

global_defs {
router_id k8s
添加内容如下:
script_user root  #使用root执行脚本
enable_script_security
…
}
此条目发表在keepalived分类目录。将固定链接加入收藏夹。

发表评论