集群部署及节点管理

使用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 ---集群部署的更多相关文章

  1. 集群容器管理之swarm ---服务管理

    服务管理 # 创建服务docker service create --replicas 1 --name hello busybox # docker service update --args &q ...

  2. 非节点主机通过内网远程管理docker swarm集群

    这是今天使用 docker swarm 遇到的一个问题,终于在睡觉前解决了,在这篇随笔中记录一下. 在 docker swarm 集群的 manager 节点上用 docker cli 命令可以正常管 ...

  3. Docker容器管理平台Rancher高可用部署——看这篇就够了

    记得刚接触Rancher时,看了官方文档云里雾里,跟着官网文档部署了高可用Rancher,发现不管怎么折腾都无法部署成功(相信已尝试的朋友也有类似的感觉),今天腾出空来写个总结,给看到的朋友留个参考( ...

  4. Docker Swarm 集群管理利器核心概念扫盲

    Swarm 简介 Docker Swarm 是 Docker 官方推出的容器集群管理工具,基于 Go 语言实现.代码开源在:https://github.com/docker/swarm 使用它可以将 ...

  5. Docker Swarm(十)Portainer 集群可视化管理

    前言 搭建好我们的容器编排集群,那我们总不能日常的时候也在命令行进行操作,所以我们需要使用到一些可视化的工具,Docker图形化管理提供了很多工具,有Portainer.Docker UI.Shipy ...

  6. [第十五篇]——Swarm 集群管理之Spring Cloud直播商城 b2b2c电子商务技术总结

    Swarm 集群管理 简介 Docker Swarm 是 Docker 的集群管理工具.它将 Docker 主机池转变为单个虚拟 Docker 主机. Docker Swarm 提供了标准的 Dock ...

  7. 基于zookeeper的Swarm集群搭建

    简介 Swarm:docker原生的集群管理工具,将一组docker主机作为一个虚拟的docker主机来管理. 对客户端而言,Swarm集群就像是另一台普通的docker主机. Swarm集群中的每台 ...

  8. Docker swarm集群增加节点和删除节点

    Docker swarm集群增加节点 docker swarm初始化 docker swarm init docker swarm 增加节点 在已经初始化的机器上执行:# docker swarm j ...

  9. Docker管理工具 - Swarm部署记录

    之前介绍了Docker集群管理工具-Kubernetes部署记录,下面介绍另一个管理工具Swarm的用法,Swarm是Docker原生的集群管理软件,与Kubernetes比起来比较简单. Swarm ...

随机推荐

  1. python爬虫——论抓包的正确姿势和学好Javascript的重要性(1)

    没事想爬下数据,就入了scrapy坑,跟着https://zhuanlan.zhihu.com/data-factory这篇教程走,中间被小数量的网站坑过,不过还是写出了爬虫~~ 切糕王子:毫无防御, ...

  2. JDK1.7安装和配置及注意事项

    要求 必备知识 windows 7 基本操作. 运行环境 windows 7 下载地址 环境下载 下载JDK 下载地址:http://www.oracle.com/technetwork/java/j ...

  3. Ansible在Ubuntu上的安装

    #apt安装 apt-get install software-properties-common apt-add-repository ppa:ansible/ansible apt-get upd ...

  4. ant___令牌过滤器

    令牌过滤器允许我们在复制时过滤文件中的数据.要进行过滤,需要使用一个必须与过滤器任务中的@token @设置匹配的标记.任务使用@作为标记分隔符.为了实现此功能,apache ant提供了使用toke ...

  5. Android studio新建文件出现setContentView(R.layout.activity_main);中的R标红错误解决方法

    今天打开Android studio突然出现了setContentView(R.layout.activity_main);中的R标红错误,这已经不是第一次出现这个错误了,真心的觉得Android s ...

  6. BZOJ 2759 一个动态树好题(动态树)

    题意 https://www.lydsy.com/JudgeOnline/problem.php?id=2759 思路 每个节点仅有一条有向出边, 这便是一棵基环内向树,我们可以把它在 \(\text ...

  7. TCP协议三次握手、四次挥手

    TCP的概述 TCP 把连接作为最基本的对象,每一条 TCP 连接都有两个端点,这种断点我们叫作套接字(socket),它的定义为端口号拼接到 IP 地址即构成了套接字,例如,若 IP 地址为 192 ...

  8. Mock.js 虚拟接口 数据模拟

    Mock.js 是一款前端开发中拦截Ajax请求再生成随机数据响应的工具.可以用来模拟服务器响应. 优点是非常简单方便, 无侵入性, 基本覆盖常用的接口数据类型. 大概记录下使用过程, 详细使用可以参 ...

  9. hduoj#1004 -Let the Balloon Rise [链表解法]

    原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1004 Problem Description Contest time again! How exci ...

  10. Qt打开文件对话框同时选中多个文件或单个文件

    Qt中打开单个文件 //str_path为文件路径 QString str_path = QFileDialog::getOpenFileName(this, tr("选择转码文件" ...