This repository was archived by the owner on Feb 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
This repository was archived by the owner on Feb 1, 2021. It is now read-only.
Proposal: Serf-discovery mode #1198
Copy link
Copy link
Closed
Description
Currently we need to hard-code a discovery URL for every swarm join to make the agent able to join a cluster. Hard-coded discovery makes this architecture not scaling very well.
This issue proposes a new architecture called self-discovery. It includes:
- IP scanning on a specific port to make an agent try its best to find a peer in the current network (but it's not the best idea anyway)
- use the old previous connection information to find a peer
- we should do only class-C scanning? is there any viable alternative?
- should we use
mdns, which requires multi-cast available on the network?
- peer-to-peer communication based on
serfto form alocalserf cluster - a small modification to
swarm manageracts as an aggregation point to tell the discovery service that we have N nodes in this local cluster.
With this architecture, it allows other managers who are sharing the same discovery URL to form a larger swarm cluster.
This diagram describes the self-discovery architecture:
Step 1. swarm join --advertise=<ip:addr> self://:3388
To make it as minimum configuration as possible,
we do heuristic-based discovery for finding peers.
So IP address should not be required in the normal scenario.
+---------+
| |
+-----------> agent +---------+ +-----------+
| | | | join | |
| +---------+ <------------+ manager |
| | | |
+---------+ +----v----+ +-----------+
| | | | | +-------------+
| agent | self-discovery | agent | | | |
| | | | | expose nodes | discovery |
+---------+ +---------+ +--------------> service |
| | | |
| +---------+ | +-------------+
| | | |
+-----------> agent <---------+
| |
+---------+
Step 2. When calling `swarm manage --self-discovery-port=3388 zk://ip:addr`,
the manager is also responsible for:
* joining a local serf cluster
* exposing the local node list to the discovery URL
* start the manager using the discovery URL
In case of starting the manager as the first node,
it also acts as the first peer waiting for other agents to join.
As discussed with @abronan on the IRC, @aluzzardi already has an idea to use serf for a similar architecture.
/cc @vieux @jimmyxian
WDYT?
Reactions are currently unavailable