上次安装完了docker,继续探索swarm,Swarm和Kubernetes比较类似,但是更加轻,具有的功能也较kubernetes更少一些。
先安装完docker
1、机器10.100.25.83上:
初始化一个Swarm群集:docker swarm init
[root@ecsnpmeybwpxc-no yum.repos.d]# docker swarm init Swarm initialized: current node (puaz9qdi3bkxak3w4gly2fjxg) is now a manager. To add a worker to this swarm, run the following command: docker swarm join --token SWMTKN-1-0kuf7ygj39r5g0gy5jsmdt99viykg8b7jb5j52hu3ipn1sq3ww-831xku6gv525oy3o07wncdsk1 10.100.25.83:2377 To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
2、机器10.100.25.13上:
[root@prodgateway-no ~]# docker swarm join > --token SWMTKN-1-0kuf7ygj39r5g0gy5jsmdt99viykg8b7jb5j52hu3ipn1sq3ww-831xku6gv525oy3o07wncdsk1 > 10.100.25.83:2377 This node joined a swarm as a worker.
3、在 manager 端10.100.25.83查看 swarm 节点信息
[root@ecsnpmeybwpxc-no ~]# docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS puaz9qdi3bkxak3w4gly2fjxg * ecsnpmeybwpxc-no.01.novalocal Ready Active Leader tzu5x27v5a3rqnmglh15z1cx9 prodgateway-no.05.novalocal Ready Active
节点2台机器都展示了
关于swarm怎么使用及监控,待续
备注:如果机器上有多个IP,比如设置了虚拟ip,需指定ip:--advertise-addr
docker swarm init --advertise-addr 172.22.90.171