集群部署及节点管理

使用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. Django-debug-toolbar的使用

    Django项目的开发过程中,离不开各种调试,那么,我们今天介绍一个工具,django debug toolbar,该工具为我们提供了更加丰富的调试信息,如提供session信息,SQL查询信息等等. ...

  2. Shell 文本处理命令

    命令:cut –d’:’ -f1, 文件名 #切割处文件列的参数. -d切割字符. -f列的第几个参数. -c1-10指定字符串范围行的第一个到第十个. 命令:sort 文件名 #根据第一列第一个字符 ...

  3. jQuery.parseJSON()方法

    jQuery.parseJSON()方法 jQuery 杂项方法 实例 解析一个 JSON 字符串 $(function () { var obj = jQuery.parseJSON('{" ...

  4. npm 清理缓存

    npm cache clean -f 有些时候npm下载资源出错,再次下载的时候可能因为之前错误的缓存造成一直下载不成功. 此时可以清一下npm的缓存,然后尝试重新下载

  5. jsp/servlet学习二之servlet详解

    Servlet API概览 Servlet API有一下四个java包: 1,javax.servlet,其中包含定义servlet和servlet容器之间契约的类和接口. 2,javax.servl ...

  6. Lintcode481-Binary Tree Leaf Sum-Easy

    481. Binary Tree Leaf Sum Given a binary tree, calculate the sum of leaves. Example Example 1: Input ...

  7. JAVA基础知识笔记

    1.类只能用Public修饰,不能使用protected.private修饰.也可以不加修饰符,称做友好类. 2.类的实体元素包含成员变量和方法的定义,成员变量分为实例变量和类变量(static修饰的 ...

  8. vue实现简单的购物车功能

    <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8&quo ...

  9. 【七】jquery之属性attr、 removeAttr、prop[全选全不选及反选]

    全选全不选 界面: 代码: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> ...

  10. vue的技巧代码

    转载:https://segmentfault.com/a/1190000014085613 第一招:化繁为简的Watchers 场景还原: created(){ this.fetchPostList ...