• 简单配置 docker swarm


    #准备三台CentOS7

    #IP划分

    192.168.1.201       virtualBox1

    192168.1.202        virtualBox2

    192168.1.204        virtualBox3

    #三台机器上分别安装docker

    docker安装

    #三台机器上分别配置加速器

    vim /etc/docker/daemon.json                  #该文件原本没有需要新建

    {
        "registry-mirrors": [ "https://docker.mirrors.ustc.edu.cn" ]
    }

    #重新载入文件

    systemctl daemon-reload

    #重启docker

    systemctl restart docker.service

    #pull下来swarm镜像

    docker pull swarm

    #创建一台swarm 管理者节点,这里我用201那台当做管理节点,在201上执行

    [root@virtualBox1 ~]# docker swarm init --advertise-addr=192.168.1.201
    Swarm initialized: current node (9crsz9bs7jmkk7jeoevbqo85n) is now a manager.

    To add a worker to this swarm, run the following command:

        docker swarm join --token SWMTKN-1-3yikwpwd7obd6rnxrb0noza7i34hl3nh7pgpc8kc7o4qabeocm-4dv5q6qd48b18oee1xa2e97m0 192.168.1.201:2377

    To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

    #在其他2台机器上执行上面粉色命令,即加入到swarm中

    [root@virtualBox2 ~]# docker swarm join --token SWMTKN-1-3yikwpwd7obd6rnxrb0noza7i34hl3nh7pgpc8kc7o4qabeocm-4dv5q6qd48b18oee1xa2e97m0 192.168.1.201:2377
    This node joined a swarm as a worker.

    [root@virtualBox3 ~]# docker swarm join --token SWMTKN-1-3yikwpwd7obd6rnxrb0noza7i34hl3nh7pgpc8kc7o4qabeocm-4dv5q6qd48b18oee1xa2e97m0 192.168.1.201:2377
    This node joined a swarm as a worker.

    #在Master端查看所有node节点

    [root@virtualBox1 ~]# docker node ls
    ID                 HOSTNAME    STATUS    AVAILABILITY    MANAGER STATUS    ENGINE VERSION
    9crsz9bs7jmkk7jeoevbqo85n *   virtualBox1       Ready       Active       Leader          19.03.1
    egyi8wm84gslxzam1i8flc1dv      virtualBox2       Ready     Active                    19.03.1
    rsl5npg6u72c67uutkaq63wsl      virtualBox3       Ready             Active                     19.03.1

  • 相关阅读:
    毕业面试心程
    hash_map的简洁实现
    缓冲区溢出攻击
    统计一下你写过多少代码
    SecureCRT自动断开
    误操作yum导致error: rpmdb
    Foxmail7.2新建的文件夹不见了
    pycurl安装
    一起用ipython
    vi/vim多行注释和取消注释
  • 原文地址:https://www.cnblogs.com/smlile-you-me/p/11255457.html
Copyright © 2020-2023  润新知