集群部署及节点管理

使用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. ListTile

    const ListTile({ Key key, this.leading, // item 前置图标 this.title, // item 标题 this.subtitle, // item 副 ...

  2. Dart编程语言入门

    Dart基础入门语法介绍,详细说明可以查看相关视频<Dart编程语言入门>. 变量与常量 变量 1.使用 var 声明变量,默认值为 null var a;//null a = 10; 2 ...

  3. Springboot 上传excel并解析文件内容

    最近在做一个物业的系统,需要通过excel上传业主的信息,解析并入库. 参考:https://www.cnblogs.com/jyyjava/p/8074322.html 话不多说,直接上核心代码 i ...

  4. zabbix链接规则

    通过磁盘  Disk for discovery    custom.vfs.dev.discovery 配置自动发现参考

  5. Odd Gnome【枚举】

    问题 I: Odd Gnome 时间限制: 1 Sec  内存限制: 128 MB 提交: 234  解决: 144 [提交] [状态] [命题人:admin] 题目描述 According to t ...

  6. VisualSFM使用记录1 unable to load libsiftgpu.so

    官网:http://ccwu.me/vsfm/(解决过程蓝色字,问题原因解决方法红色字)SFM computer missing match阶段运行出现错误 More than 189MB of gr ...

  7. Vue:(四)Ajax(Vue-Resource)

    Vue 要实现异步加载需要使用到 vue-resource 库.(挂载到vue实例上) (一)Vue-Resource引入 <script src="https://cdn.stati ...

  8. GitHub的Windows客户端的使用教程

    GitHub for Windows客户端的使用教程 什么是Github >说到什么是GitHub,我们先看wikipedia的描述“GitHub是一个利用Git进行版本控制.专门用于存放软件代 ...

  9. java泛型使用教程

    参考: java 泛型    Java泛型中E.T.K.V等的含义 一.Java泛型中E.T.K.V等的含义 E - Element (在集合中使用,因为集合中存放的是元素) T - Type(Jav ...

  10. sigmod函数

    #include <cmath> //math.h double sigmod(double x) { return 1/(1+exp(-x)); }