[No Audio]
In this demo, we have three terminals, one for each node.
First of all, let's have a list of
nodes with docker-machine ls command. As you can
see, we have manager, worker-1 and worker-2.
Now, let's ssh into our manager, just like we did
in the last demo. Since we want to make this
manager node, manager, which is quite the literal
term for its role, let's initialize our Swarm
using docker swarm init command, and advertise its
IP address to the other nodes. Once we hit enter,
the Swarm mode gets initialized and the current
node which is manager node becomes manager. Now, if
we want to add workers to this manager node,
we can run docker swarm join command from respective
worker nodes along with the token, which is
generated from this manager node. This token is a
unique ID, which can be used by other nodes to
join our manager as a part of its cluster.
In case we have lost this command or token, we can get it
back by typing docker swarm join-token worker.
But this command will only work if the manager has
been initialized with swarm mode. We will use this
docker swarm join command along with its token
from both worker-1 and worker-2, to make sure
that both of them join this cluster as workers
while the current node remains manager.
As you can see, the command has worked successfully from
worker-1 node and it has joined the swarm
cluster as a worker.
Similarly, the command was successful in worker two as well
and we got similar confirmation.