Peer-to-Peer
The other coordinators all route notifications through a messaging server. With peer-to-peer coordination, the nodes of a cluster instead send notifications to each other directly, over the Eclipse Zenoh protocol, with no server in between. The nodes find each other in one of two ways: automatically, on networks that allow multicast, or through a configured list of peers.
Peer-to-peer coordination removes the messaging server, but not the other shared services. A cluster coordinated through Zenoh still requires a Redis-based in-memory store, configured before the coordinator as described in Coordination mechanism. That Redis deployment could serve as the coordinator as well, so Zenoh does not reduce the number of services a cluster depends on.
Zenoh support is not part of the official binaries. Using it requires compiling Stalwart with the zenoh feature, and an official binary on which Zenoh is selected logs Binary was not compiled with the selected coordinator backend.
Configuration
Section titled “Configuration”Zenoh coordination is selected with the Zenoh variant of the Coordinator object (found in the WebUI under Settings › Cluster › Coordinator). Its single field, config, contains a Zenoh configuration document in JSON5 syntax, which Stalwart passes to Zenoh unchanged. The Zenoh configuration reference describes the available options. If the document cannot be parsed, the coordinator is not started, and the server reports Invalid Zenoh config: <reason>.
On a network that allows multicast, the nodes can discover each other without any list. The following configuration runs each node as a Zenoh peer, and discovers the other nodes by multicast scouting on Zenoh’s default group, 224.0.0.224, port 7446:
{ "@type": "Zenoh", "config": "{ mode: \"peer\", scouting: { multicast: { enabled: true, address: \"224.0.0.224:7446\" } } }"}Multicast is often unavailable between hosts in cloud environments and across routed networks. In those cases, disable multicast scouting and list the other nodes as endpoints to connect to:
{ "@type": "Zenoh", "config": "{ mode: \"peer\", scouting: { multicast: { enabled: false } }, listen: { endpoints: [\"tcp/0.0.0.0:7447\"] }, connect: { endpoints: [\"tcp/10.0.0.11:7447\", \"tcp/10.0.0.12:7447\"] } }"}Each node then listens on the given port and connects to the listed peers, so the port must be reachable between the nodes.