首页 > 代码库 > add nodes to the swarm
add nodes to the swarm
一旦你们创建了一个带有管理节点的swarm集群,你就可以开始添加 worker节点
$ docker-machine ssh worker1 $ docker swarm join --token SWMTKN-1-49nj1cmql0jkz5s954yi3oex3nedyz0fb0xx14ie39trti4wxv-8vxv8rssmk743ojnwacrr2e7c 192.168.99.100:2377 This node joined a swarm as a worker.
你可以在管理节点通过下面命令来获取token
$ docker swarm join-token worker To add a worker to this swarm, run the following command: docker swarm join --token SWMTKN-1-49nj1cmql0jkz5s954yi3oex3nedyz0fb0xx14ie39trti4wxv-8vxv8rssmk743ojnwacrr2e7c 192.168.99.100:2377
把worker2 节点也加入进来
$ docker-machine ssh worker2 $ docker swarm join --token SWMTKN-1-49nj1cmql0jkz5s954yi3oex3nedyz0fb0xx14ie39trti4wxv-8vxv8rssmk743ojnwacrr2e7c 192.168.99.100:2377 This node joined a swarm as a worker.
查看所有节点的信息:(只能在管理节点执行)
$docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 03g1y59jwfg7cf99w4lt0f662 worker2 Ready Active 9j68exjopxe7wfl6yuxml7a7j worker1 Ready Active dxn1zf6l61qsb1josjja83ngz * manager1 Ready Active Leader
manager列留空的是 worker节点
Leader 表示该节点为 manager节点
docker node ls 命令只能在 manager节点才能运行
本文出自 “清风柳絮” 博客,请务必保留此出处http://binuu.blog.51cto.com/801317/1942314
add nodes to the swarm
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。