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

The image is a slide titled "Gossip Protocol," explaining the LAN Gossip Pool and its purpose, including membership information, failure detection, and event broadcasts. It features a pixelated design at the top and a cartoon character at the bottom right.

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

The image is a slide about the "Gossip Protocol," explaining the WAN Gossip Pool and its purpose, which includes enabling cross-datacenter requests and handling server or datacenter failures.

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

FeatureLAN Gossip PoolWAN Gossip Pool
ParticipantsAll servers & clients in one datacenterOnly server nodes across federated datacenters
Membership ManagementDynamic joins and leavesServer-to-server peer exchange
Failure DetectionDistributed across all membersFocused on server health across datacenters
Use CasesLocal discovery, event broadcastsCross-DC discovery, failover, disaster recovery

Multi-Data-Center Deployment

The image illustrates a "Gossip Protocol" network diagram, showing communication between servers and clients across two data centers (DC1 and DC2) using LAN and WAN gossip.

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.

Watch Video

Watch video content

Previous
Consensus Protocol Raft