github.com/brahmaroutu/docker@v1.2.1-0.20160809185609-eb28dde01f16/docs/swarm/join-nodes.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Join nodes to a swarm"
     4  description = "Add worker and manager nodes to a swarm"
     5  keywords = ["guide, swarm mode, node"]
     6  [menu.main]
     7  identifier="join-nodes-guide"
     8  parent="engine_swarm"
     9  weight=13
    10  +++
    11  <![end-metadata]-->
    12  
    13  # Join nodes to a swarm
    14  
    15  When you first create a swarm, you place a single Docker Engine (Engine) into
    16  swarm mode. To take full advantage of swarm mode you can add nodes to the swarm:
    17  
    18  * Adding worker nodes increases capacity. When you deploy a service to a swarm,
    19  the Engine schedules tasks on available nodes whether they are worker nodes or
    20  manager nodes. When you add workers to your swarm, you increase the scale of
    21  the swarm to handle tasks without affecting the manager raft consenus.
    22  * Manager nodes increase fault-tolerance. Manager nodes perform the
    23  orchestration and cluster management functions for the swarm. Among manager
    24  nodes, a single leader node conducts orchestration tasks. If a leader node
    25  goes down, the remaining manager nodes elect a new leader and resume
    26  orchestration and maintenance of the swarm state. By default, manager nodes
    27  also run tasks.
    28  
    29  Before you add nodes to a swarm you must install Docker Engine 1.12 or later on
    30  the host machine.
    31  
    32  The Docker Engine joins the swarm depending on the **join-token** you provide to
    33  the `docker swarm join` command. The node only uses the token at join time. If
    34  you subsequently rotate the token, it doesn't affect existing swarm nodes. Refer
    35  to [Run Docker Engine in swarm mode](swarm-mode.md#view-the-join-command-or-update-a-swarm-join-token).
    36  
    37  ## Join as a worker node
    38  
    39  To retrieve the join command including the join token for worker nodes, run the
    40  following command on a manager node:
    41  
    42  ```bash
    43  $ docker swarm join-token worker
    44  
    45  To add a worker to this swarm, run the following command:
    46  
    47      docker swarm join \
    48      --token SWMTKN-1-49nj1cmql0jkz5s954yi3oex3nedyz0fb0xx14ie39trti4wxv-8vxv8rssmk743ojnwacrr2e7c \
    49      192.168.99.100:2377
    50  ```
    51  
    52  Run the command from the output on the worker to join the swarm:
    53  
    54  ```bash
    55  $ docker swarm join \
    56    --token SWMTKN-1-49nj1cmql0jkz5s954yi3oex3nedyz0fb0xx14ie39trti4wxv-8vxv8rssmk743ojnwacrr2e7c \
    57    192.168.99.100:2377
    58  
    59  This node joined a swarm as a worker.
    60  ```
    61  
    62  The `docker swarm join` command does the following:
    63  
    64  * switches the Docker Engine on the current node into swarm mode.
    65  * requests a TLS certificate from the manager.
    66  * names the node with the machine hostname
    67  * joins the current node to the swarm at the manager listen address based upon the swarm token.
    68  * sets the current node to `Active` availability, meaning it can receive tasks
    69  from the scheduler.
    70  * extends the `ingress` overlay network to the current node.
    71  
    72  ### Join as a manager node
    73  
    74  When you run `docker swarm join` and pass the manager token, the Docker Engine
    75  switches into swarm mode the same as for workers. Manager nodes also participate
    76  in the raft consensus. The new nodes should be `Reachable`, but the existing
    77  manager will remain the swarm `Leader`.
    78  
    79  Docker recommends three or five manager nodes per cluster to implement high
    80  availability. Because swarm mode manager nodes share data using Raft, there
    81  must be an odd number of managers. The swarm can continue to function after as
    82  long as a quorum of more than half of the manager nodes are available.
    83  
    84  For more detail about swarm managers and administering a swarm, see
    85  [Administer and maintain a swarm of Docker Engines](admin_guide.md).
    86  
    87  To retrieve the join command including the join token for manager nodes, run the
    88  following command on a manager node:
    89  
    90  ```bash
    91  $ docker swarm join-token manager
    92  
    93  To add a manager to this swarm, run the following command:
    94  
    95      docker swarm join \
    96      --token SWMTKN-1-61ztec5kyafptydic6jfc1i33t37flcl4nuipzcusor96k7kby-5vy9t8u35tuqm7vh67lrz9xp6 \
    97      192.168.99.100:2377
    98  ```
    99  
   100  Run the command from the output on the manager to join the swarm:
   101  
   102  ```bash
   103  $ docker swarm join \
   104    --token SWMTKN-1-61ztec5kyafptydic6jfc1i33t37flcl4nuipzcusor96k7kby-5vy9t8u35tuqm7vh67lrz9xp6 \
   105    192.168.99.100:2377
   106  
   107  This node joined a swarm as a manager.
   108  ```
   109  
   110  ## Learn More
   111  
   112  * `swarm join`[command line reference](../reference/commandline/swarm_join.md)
   113  * [Swarm mode tutorial](swarm-tutorial/index.md)