1 00:00:00,001 --> 00:00:03,234 [No Audio] 2 00:00:03,234 --> 00:00:07,601 In this demo, we have three terminals, one for each node. 3 00:00:07,767 --> 00:00:09,900 First of all, let's have a list of 4 00:00:09,900 --> 00:00:13,380 nodes with docker-machine ls command. As you can 5 00:00:13,380 --> 00:00:17,101 see, we have manager, worker-1 and worker-2. 6 00:00:17,567 --> 00:00:21,510 Now, let's ssh into our manager, just like we did 7 00:00:21,510 --> 00:00:24,990 in the last demo. Since we want to make this 8 00:00:24,990 --> 00:00:28,590 manager node, manager, which is quite the literal 9 00:00:28,590 --> 00:00:32,334 term for its role, let's initialize our Swarm 10 00:00:32,433 --> 00:00:36,450 using docker swarm init command, and advertise its 11 00:00:36,450 --> 00:00:40,834 IP address to the other nodes. Once we hit enter, 12 00:00:40,934 --> 00:00:45,300 the Swarm mode gets initialized and the current 13 00:00:45,300 --> 00:00:49,620 node which is manager node becomes manager. Now, if 14 00:00:49,620 --> 00:00:51,934 we want to add workers to this manager node, 15 00:00:51,934 --> 00:00:55,440 we can run docker swarm join command from respective 16 00:00:55,440 --> 00:00:58,350 worker nodes along with the token, which is 17 00:00:58,350 --> 00:01:02,730 generated from this manager node. This token is a 18 00:01:02,730 --> 00:01:06,569 unique ID, which can be used by other nodes to 19 00:01:06,569 --> 00:01:10,101 join our manager as a part of its cluster. 20 00:01:10,667 --> 00:01:14,910 In case we have lost this command or token, we can get it 21 00:01:14,910 --> 00:01:19,034 back by typing docker swarm join-token worker. 22 00:01:19,201 --> 00:01:22,740 But this command will only work if the manager has 23 00:01:22,740 --> 00:01:25,920 been initialized with swarm mode. We will use this 24 00:01:25,920 --> 00:01:28,830 docker swarm join command along with its token 25 00:01:28,830 --> 00:01:32,567 from both worker-1 and worker-2, to make sure 26 00:01:32,567 --> 00:01:35,834 that both of them join this cluster as workers 27 00:01:35,867 --> 00:01:38,701 while the current node remains manager. 28 00:01:39,167 --> 00:01:42,780 As you can see, the command has worked successfully from 29 00:01:42,780 --> 00:01:46,050 worker-1 node and it has joined the swarm 30 00:01:46,050 --> 00:01:47,867 cluster as a worker. 31 00:01:48,301 --> 00:01:52,067 Similarly, the command was successful in worker two as well 32 00:01:52,067 --> 00:01:54,234 and we got similar confirmation.