Docker使用swarm创建集群

初始化集群

1
docker swarm init --advertise-addr <MANAGER-IP>
1
2
3
4
5
6
7
8
9
10
$ docker swarm init --advertise-addr 192.168.99.101  //初始化管理节点
Swarm initialized: current node (e3nzsw54azshg1clkiithvl9f) is now a manager.

To add a worker to this swarm, run the following command:

docker swarm join \
--token SWMTKN-1-2d3t6j9lub3c54lptjokjampxh1vxuu0rq78bfdmegbd9566yb-7oyake9bnhg448pf24m9cfsf8 \
192.168.99.101:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

添加工作节点到集群

(1)在工作节点进行添加

1
2
3
4
$ docker swarm join \
--token SWMTKN-1-2d3t6j9lub3c54lptjokjampxh1vxuu0rq78bfdmegbd9566yb-7oyake9bnhg448pf24m9cfsf8 \
192.168.99.101:2377
This node joined a swarm as a worker.

(2)在管理节点进行添加

1
$ docker swarm join-token worker

列出集群节点

在管理节点manager输入

1
2
3
4
$ docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
e3nzsw54azshg1clkiithvl9f * manager Ready Active Leader
i3pnnzfmi0wpxvuptlu3z9cqj worker Ready Active

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :