libcluster v2.3.0 Cluster.Strategy.Gossip

This clustering strategy uses multicast UDP to gossip node names to other nodes on the network. These packets are listened for on each node as well, and a connection will be established between the two nodes if they are reachable on the network, and share the same magic cookie. In this way, a cluster of nodes may be formed dynamically.

The gossip protocol is extremely simple, with a prelude followed by the node name which sent the packet. The node name is parsed from the packet, and a connection attempt is made. It will fail if the two nodes do not share a cookie.

By default, the gossip occurs on port 45892, using the multicast address 230.1.1.251

You may configure the multicast address, the interface address to bind to, the port, and the TTL of the packets, using the following settings:

config :libcluster,
  topologies: [
    gossip_example: [
      strategy: Elixir.Cluster.Strategy.Gossip,
      config: [
        port: 45892,
        if_addr: "0.0.0.0",
        multicast_addr: "230.1.1.251",
        multicast_ttl: 1]]]

A TTL of 1 will limit packets to the local network, and is the default TTL.

Link to this section Summary

Link to this section Functions

Link to this function start_link(opts)

Callback implementation for Cluster.Strategy.start_link/1.

Link to this function terminate(type, reason, state)