HashiCorp Certified: Consul Associate Certification
Explain Consul Architecture
Gossip Protocol Serf
Consul leverages the Gossip Protocol alongside Raft-based consensus to maintain cluster state, membership, and failure detection. Gossip enables efficient, scalable communication within a data center (LAN) and across data centers (WAN), ensuring service discovery, health checks, and cross-datacenter failover.
How Gossip Works
Gossip is a peer-to-peer communication mechanism originally implemented by Serf. Each node periodically selects peers to exchange state information, propagating membership updates, health events, and configuration data throughout the cluster.
Note
Gossip messages are compact, encrypted (when TLS is enabled), and piggyback on both UDP and TCP for reliability and low latency.
LAN Gossip Pool
In a single data center, all Consul servers and clients form the LAN Gossip Pool. This pool handles:
- Dynamic Membership
New nodes join by pointing to any existing member; gossip automatically propagates their presence and discovers Consul servers. - Failure Detection
All members—servers and clients—participate in health checks to detect unreachable nodes. - Event Broadcasting
Low-latency, reliable dissemination of events (join, leave, failure) to all members.
WAN Gossip Pool
Across federated data centers, only Consul server nodes form the WAN Gossip Pool. Clients do not participate directly. Key responsibilities include:
- Cross-Data-Center Discovery
Servers share membership and health data across data centers. - Failover Support
Prepared queries with failover policies route requests to healthy services in another data center. - Disaster Recovery
Maintains service resolution and availability even if an entire data center becomes unreachable.
Comparing LAN vs WAN Gossip
Feature | LAN Gossip Pool | WAN Gossip Pool |
---|---|---|
Participants | All servers & clients in one datacenter | Only server nodes across federated datacenters |
Membership Management | Dynamic joins and leaves | Server-to-server peer exchange |
Failure Detection | Distributed across all members | Focused on server health across datacenters |
Use Cases | Local discovery, event broadcasts | Cross-DC discovery, failover, disaster recovery |
Multi-Data-Center Deployment
When DC1 and DC2 are federated via a WAN join:
- Each data center maintains its own LAN Gossip Pool for local clients and servers.
- Server nodes across DC1 and DC2 merge into a unified WAN Gossip Pool.
- Clients in DC1 can query and route to services in DC2 (and vice versa).
- Health and membership events propagate globally, enabling seamless failover.
Links and References
Watch Video
Watch video content