How does keepalived work?
Keepalived is a software implementation based on the VRRP protocol, and its operation is as follows:
- Keepalived runs on each server, listening to VRRP broadcast messages from other servers over the network.
- When a server experiences a malfunction or network anomaly, the other servers will detect this change and elect a new master server based on VRRP priority rules.
- The new main server will take over the IP address of the faulty server, becoming the owner of the new virtual IP (VIP).
- The virtual IP (VIP) is configured as the default gateway by the router, which achieves load balancing and failover.
- When the faulty server is restored to normal, it will rejoin the election process and determine whether to become the new master server based on VRRP priority rules.
In summary, Keepalived utilizes the VRRP protocol to achieve server failover and load balancing, ensuring high availability and reliability of the system.