四、搭建Swarm集群
(1)进入manager
提示
:manager node也可以作为worker node提供服务
docker swarm init --advertise-addr=192.168.0.11
注意观察日志,拿到worker node加入manager node的信息
docker swarm join --token SWMTKN-1-0a5ph4nehwdm9wzcmlbj2ckqqso38pkd238rprzwcoawabxtdq-arcpra6yzltedpafk3qyvv0y3 192.168.0.11:2377
(2)进入两个worker
docker swarm join --token SWMTKN-1-0a5ph4nehwdm9wzcmlbj2ckqqso38pkd238rprzwcoawabxtdq-arcpra6yzltedpafk3qyvv0y3 192.168.0.11:2377
日志打印
This node joined a swarm as a worker.
(3)进入到manager node查看集群状态
docker node ls
(4)node类型的转换
可以将worker提升成manager,从而保证manager的高可用
docker node promote worker01-node docker node promote worker02-node #降级可以用demote docker node demote worker01-node
在线的Docker网址(4小时的会话有效期)