Checking a service
So the VIP moves when the application fails, not only when the whole node does:
High availability through a virtual IP — failover between nodes using VRRP.
ip a | grep VIP
which node is MASTER right now
journalctl -u keepalived -f
state transitions
/etc/keepalived/keepalived.conf (on the MASTER):
On the BACKUP — the same, but state BACKUP and priority 90.
| Directive | Meaning |
|---|---|
priority |
weight in the MASTER election (higher wins) |
nopreempt |
don't take the VIP back on return (avoid extra flips) |
unicast_peer |
VRRP over unicast (clouds/networks without multicast) |
vrrp_script + track_script |
check a service → lower priority on failure |
Nothing found. Try a shorter query.
So the VIP moves when the application fails, not only when the whole node does:
The nodes don't see each other's VRRP advertisements. The cause is
the firewall blocking VRRP (protocol 112, multicast
224.0.0.18) or a mismatched virtual_router_id. Allow VRRP between the
nodes; in a cloud without multicast, use unicast_peer.
There's no track_script — the VIP stays as long as the node is alive, even
if the service died. Add a vrrp_script/track_script with a weight.
The vrrp_script is too sensitive, or a recovered MASTER takes the VIP
back. Set nopreempt on the BACKUP nodes, or increase
interval/fall/rise.
Within one L2 segment, virtual_router_id must be unique per group; a clash
with another group breaks the election.
ip a on each node (the VIP only shows on the MASTER),
journalctl -u keepalived for the state transitions (see ip).
Found an inaccuracy? Report an error in the article