Keepalived
keepalived.conf
vrrp_instance VI_1 {
state MASTER
interface eno1
virtual_router_id 42
priority 64
advert_int 1
authentication {
auth_type PASS
auth_pass sxdsC66K
}
virtual_ipaddress {
10.10.10.10/24
}
notify /opt/slg/broadcastsuite/samples/keepalived_notify.sh
}
keepalived_notify.sh
#!/bin/bash
ENDSTATE=$3
NAME=$2
TYPE=$1
NODESTATE=2
case $ENDSTATE in
"BACKUP") # Transition to BACKUP state
echo "Setting Broadcast Suite role to SECONDARY"
NODESTATE=2
;;
"FAULT") # Transition to FAULT state
echo "Setting Broadcast Suite role to SECONDARY"
NODESTATE=2
;;
"MASTER") # Transition to MASTER state
echo "Setting Broadcast Suite role to PRIMARY"
NODESTATE=1
;;
*) echo "Unknown state ${ENDSTATE} for VRRP ${TYPE} ${NAME}"
exit 1
;;
esac
curl -X POST -H "Content-Type: application/json" \
-d '{}' \
http://127.0.0.1:8085/api/v1/system/NodeState?NodeState=$NODESTATE
exit 0;