Hi,
The original keepalived can support switches between master and backup with script like this:
keepalived.conf ... vrrp_script check_program_status { script "/etc/keepalived/script/check_program_status.sh" interval 3 weight 60 fall 2 rise 1 } vrrp_instance VI_1 { ... state BACKUP interface eth1 priority 100 track_script { check_program_status } notify_master "/etc/keepalived/script/notify.sh master" notify_backup "/etc/keepalived/script/notify.sh backup" }
If the script check_program_status.sh return non zero, the master node will decrease the value of priority and become the backup node, the backup node will become the master node. The notify.sh will complete assigned tasks when status switching between master and backup.