Docker使用swarm创建集群
初始化集群
docker swarm init --advertise-addr <MANAGER-IP>
$ 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)在工作节点进行添加
$ docker swarm join \
--token SWMTKN-1-2d3t6j9lub3c54lptjokjampxh1vxuu0rq78bfdmegbd9566yb-7oyake9bnhg448pf24m9cfsf8 \
192.168.99.101:2377
This node joined a swarm as a worker.
(2)在管理节点进行添加
$ docker swarm join-token worker
列出集群节点
在管理节点manager输入
$ docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
e3nzsw54azshg1clkiithvl9f * manager Ready Active Leader
i3pnnzfmi0wpxvuptlu3z9cqj worker Ready Active
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/02/26/docker-uses-swarm-to-create-a-cluster/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
打赏
海报
Docker使用swarm创建集群
初始化集群
docker swarm init --advertise-addr <MANAGER-IP>
$ docker swarm init --advertise-addr 192.168.99.101 //初始化管理节点
Swarm initia……
文章目录
关闭
共有 0 条评论