集群容器管理之swarm ---集群部署
集群部署及节点管理
使用swarm前提: Docker版本1.12+
集群节点之间保证TCP 2377、TCP/UDP 7946和UDP 4789端口通信
节点规划: 操作系统:centos7.4.1708
管理节点:192.168.3.245 node1
工作节点:192.168.3.244
工作节点:192.168.3.246
管理节点初始化swarm: docker swarm init --advertise-addr 192.168.3.245
工作节点加入swarm: docker swarm join --token SWMTKN-1-XXX 192.168.3.245:2377
cat /etc/yum.repos.d/docker.repo
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
#curl -sSL https://get.docker.com/ | sh
# systemctl start docker
# systemctl enable docker
# curl -L https://get.daocloud.io/docker/compose/releases/download/1.20.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
# chmod +x /usr/local/bin/docker-compose
# docker-compose -v
docker-compose version 1.20.1, build 5d8c71b
[root@node1 ~]# docker swarm init --advertise-addr 192.168.3.245
Swarm initialized: current node (72664vnxwv9efmib5lr9rli3j) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-0blcl3t4a82sutk6dmj9otdjvr5t1y9tklcx624izcvab38vo8-8yvuv3p8k5yg8h87ka6e3h3o0 \
192.168.3.245:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

[root@node2 ~]# docker swarm join --token SWMTKN-1-0blcl3t4a82sutk6dmj9otdjvr5t1y9tklcx624izcvab38vo8-8yvuv3p8k5yg8h87ka6e3h3o0 192.168.3.245:2377
[root@node3 ~]# docker swarm join --token SWMTKN-1-0blcl3t4a82sutk6dmj9otdjvr5t1y9tklcx624izcvab38vo8-8yvuv3p8k5yg8h87ka6e3h3o0 192.168.3.245:2377

[root@node1 ~]# docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
72664vnxwv9efmib5lr9rli3j * node1 Ready Active Leader
odtu70p5unyiy3hvowbraw2lj node3 Ready Active
zhg2isim7fj2osyvg7x7yls0i node2 Ready Active

[root@node1 ~]# docker node --help
Usage: docker node COMMAND
Manage Swarm nodes
Options:
--help Print usage
Commands:
demote Demote one or more nodes from manager in the swarm
inspect Display detailed information on one or more nodes
ls List nodes in the swarm
promote Promote one or more nodes to manager in the swarm
ps List tasks running on one or more nodes, defaults to current node
rm Remove one or more nodes from the swarm
update Update a node
Run 'docker node COMMAND --help' for more information on a command.
[root@node1 ~]# docker node inspect --pretty node1
ID: 72664vnxwv9efmib5lr9rli3j
Hostname: node1
Joined at: 2018-03-31 00:12:44.776269654 +0000 utc
Status:
State: Ready
Availability: Active
Address: 127.0.0.1
Manager Status:
Address: 192.168.3.245:2377
Raft Status: Reachable
Leader: Yes
Platform:
Operating System: linux
Architecture: x86_64
Resources:
CPUs: 4
Memory: 7.639 GiB
Plugins:
Network: bridge, host, macvlan, null, overlay
Volume: local
Engine Version: 1.13.1
[root@node1 ~]# docker node inspect --pretty node2
ID: zhg2isim7fj2osyvg7x7yls0i
Hostname: node2
Joined at: 2018-03-31 00:14:47.092619115 +0000 utc
Status:
State: Ready
Availability: Active
Address: 192.168.3.244
Platform:
Operating System: linux
Architecture: x86_64
Resources:
CPUs: 4
Memory: 7.639 GiB
Plugins:
Network: bridge, host, macvlan, null, overlay
Volume: local
Engine Version: 1.13.1
[root@node1 ~]# docker node inspect --pretty node3
ID: odtu70p5unyiy3hvowbraw2lj
Hostname: node3
Joined at: 2018-03-31 00:14:49.644601659 +0000 utc
Status:
State: Ready
Availability: Active
Address: 192.168.3.246
Platform:
Operating System: linux
Architecture: x86_64
Resources:
CPUs: 4
Memory: 7.639 GiB
Plugins:
Network: bridge, host, macvlan, null, overlay
Volume: local
Engine Version: 1.13.1
集群容器管理之swarm ---集群部署的更多相关文章
- 集群容器管理之swarm ---服务管理
服务管理 # 创建服务docker service create --replicas 1 --name hello busybox # docker service update --args &q ...
- 非节点主机通过内网远程管理docker swarm集群
这是今天使用 docker swarm 遇到的一个问题,终于在睡觉前解决了,在这篇随笔中记录一下. 在 docker swarm 集群的 manager 节点上用 docker cli 命令可以正常管 ...
- Docker容器管理平台Rancher高可用部署——看这篇就够了
记得刚接触Rancher时,看了官方文档云里雾里,跟着官网文档部署了高可用Rancher,发现不管怎么折腾都无法部署成功(相信已尝试的朋友也有类似的感觉),今天腾出空来写个总结,给看到的朋友留个参考( ...
- Docker Swarm 集群管理利器核心概念扫盲
Swarm 简介 Docker Swarm 是 Docker 官方推出的容器集群管理工具,基于 Go 语言实现.代码开源在:https://github.com/docker/swarm 使用它可以将 ...
- Docker Swarm(十)Portainer 集群可视化管理
前言 搭建好我们的容器编排集群,那我们总不能日常的时候也在命令行进行操作,所以我们需要使用到一些可视化的工具,Docker图形化管理提供了很多工具,有Portainer.Docker UI.Shipy ...
- [第十五篇]——Swarm 集群管理之Spring Cloud直播商城 b2b2c电子商务技术总结
Swarm 集群管理 简介 Docker Swarm 是 Docker 的集群管理工具.它将 Docker 主机池转变为单个虚拟 Docker 主机. Docker Swarm 提供了标准的 Dock ...
- 基于zookeeper的Swarm集群搭建
简介 Swarm:docker原生的集群管理工具,将一组docker主机作为一个虚拟的docker主机来管理. 对客户端而言,Swarm集群就像是另一台普通的docker主机. Swarm集群中的每台 ...
- Docker swarm集群增加节点和删除节点
Docker swarm集群增加节点 docker swarm初始化 docker swarm init docker swarm 增加节点 在已经初始化的机器上执行:# docker swarm j ...
- Docker管理工具 - Swarm部署记录
之前介绍了Docker集群管理工具-Kubernetes部署记录,下面介绍另一个管理工具Swarm的用法,Swarm是Docker原生的集群管理软件,与Kubernetes比起来比较简单. Swarm ...
随机推荐
- Kafka学习之(二)Centos下安装Kafka
环境:Centos6.4,官方下载地址:http://kafka.apache.org/downloads ,前提是还需要安装了Java环境,本博客http://www.cnblogs.com/wt ...
- 安装JDK并配置环境变量以及Hello World
摘要:本文主要说明在Windows环境下JDK的安装,以及安装完成之后环境变量的配置,并通过DOS运行简单的Java程序. 安装JDK 说明 SDK:软件开发工具包(Software Developm ...
- Python Redis 常用操作
delete(*names) # 根据删除redis中的任意数据类型 exists(name) # 检测redis的name是否存在 keys(pattern='*') # 根据模型获取redis的n ...
- yaf
一.yaf使用自定义的类 Yaf的library和model的文件命名规则和调用:https://www.cnblogs.com/leedom/p/9396138.html 安装参考: https:/ ...
- JS设计模式(9)享元模式
什么是享元模式? 定义:享元模式是一种优化程序性能的模式,本质为减少对象创建的个数. 主要解决:在有大量对象时,有可能会造成内存溢出,我们把其中共同的部分抽象出来,如果有相同的业务请求,直接返回在内存 ...
- Ubuntu如何自定义tftp服务根目录
答:修改/etc/default/tftpd-hpa中的TFTP_DIRECTORY即可,默认TFTP_DIRECTORY="/var/lib/tftpboot"
- POJ 2774 Long Long Message (二分 + Hash 求最长公共子串)题解
题意:求最长公共子串 思路:把两个串Hash,然后我们把短的作为LCS的最大可能值,然后二分长度,每次判断这样二分可不可以.判断时,先拿出第一个母串所有len长的子串,排序,然后枚举第二个母串len长 ...
- 【C++】回看面向对象与C++
本文将记录在C++与面向对象的重新学习过程中的要点: 未定义行为
- 【Git】vs code+git 不使用ssh的链接remote server的方式
git config --global user.name "dennis wu" git config --global user.email "email" ...
- 使用windeployqt工具来进行Qt的打包发布
https://blog.csdn.net/sinat_36264666/article/details/73305712