• 【Linux】Docker swarm集群


    1.三台服务器准备 Ubuntu18.04

    192.168.0.5 manager

    192.168.0.4 node1

    192.168.0.8 node2

    2.添加以上入/etc/hosts

    3.设定hostname

    hostnamectl set-hostname manager

    hostnamectl set-hostname node1

    hostnamectl set-hostname node2

    4.分别安装docker

    • wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-cli-19.03.6-3.el7.x86_64.rpm
    • wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
    • wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-19.03.6-3.el7.x86_64.rpm
    • yum install -y docker-ce-cli-19.03.6-3.el7.x86_64.rpm containerd.io-1.2.6-3.3.el7.x86_64.rpm docker-ce-19.03.6-3.el7.x86_64.rpm
    • systemctl start docker

    5.分别配置国内源

    • vi /etc/docker/daemon.json
    • {
    • "registry-mirrors": ["http://hub-mirror.c.163.com"]
    • }
    • systemctl daemon-reload
    • systemctl restart docker

    6.分别安装criu

    • yum install -y criu

    7.manager节点初始化swarm集群

    [root@manager ~]# docker swarm init --advertise-addr 192.168.0.105
    Swarm initialized: current node (jy9rsowc1xbiroxvtami7yl18) is now a manager.
    
    To add a worker to this swarm, run the following command:
    
        docker swarm join --token SWMTKN-1-4v55ca4vw1t5gihtiay5pu0qdzpof75km0ke3gsapxlllx4ush-eg1u7serdhg729le2el7h0s17 192.168.0.105:2377
    
    To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

    8.在node节点执行join加入集群

        docker swarm join --token SWMTKN-1-4v55ca4vw1t5gihtiay5pu0qdzpof75km0ke3gsapxlllx4ush-eg1u7serdhg729le2el7h0s17 192.168.0.105:2377

    9.manager节点查看节点

    [root@manager ~]# docker node ls
    ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS      ENGINE VERSION
    jy9rsowc1xbiroxvtami7yl18 *   manager             Ready               Active              Leader              18.03.1-ce
    xpnx8viazr8c0lctvgbsd94up     node1               Ready               Active                                  18.03.1-ce
    41pfh71ycle45opuhixoe5w14     node2               Ready               Active                                  18.03.1-ce

    参考:https://www.cnblogs.com/zhujingzhi/p/9792432.html

  • 相关阅读:
    Tor网络突破IP封锁,爬虫好搭档【入门手册】
    ubuntu python3相关
    toutiao url
    处理跨域请求
    Python使用虚拟环境
    Python删除文件,空文件夹,非空文件夹
    如何在jupyter中使用Python2和Python3
    推荐使用国内的豆瓣源安装Python插件
    Python数据库查询之组合条件查询-F&Q查询
    获取Django项目的全部url
  • 原文地址:https://www.cnblogs.com/jxd283465/p/12333490.html
Copyright © 2020-2023  润新知