Skip to content
This repository was archived by the owner on Feb 1, 2021. It is now read-only.
This repository was archived by the owner on Feb 1, 2021. It is now read-only.

Proposal: Serf-discovery mode #1198

@chanwit

Description

@chanwit

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 serf to form a local serf cluster
  • a small modification to swarm manager acts 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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions