This is a simple solution for when you use keepalived with VRRP to failover between two instances of an application (e.g. nginx) that uses Redis/Valkey.
It doesn’t provide a high guarantee of data consistency, so it’s only suitable for caches, user sessions and similar!
keepalived.conf example:
vrrp_instance vi {
...
notify "/etc/keepalived/scripts/notify_valkey.sh"
}