zoukankan      html  css  js  c++  java
  • Docker 搭建 etcd 集群配置

    #关闭selinux、防火墙

    systemctl stop firewalld.service
    systemctl disable firewalld.service
    firewall-cmd --state
    sed -i '/^SELINUX=.*/c SELINUX=disabled' /etc/selinux/config
    sed -i 's/^SELINUXTYPE=.*/SELINUXTYPE=disabled/g' /etc/selinux/config
    grep --color=auto '^SELINUX' /etc/selinux/config
    setenforce 0

    # 节点node1

    docker run -d --name etcd --restart=always 
        -p 2379:2379 
        -p 2380:2380 
        kubernetes/etcd:v3.2.4 
        /usr/local/bin/etcd 
        --name node1 
        --initial-advertise-peer-urls http://172.19.15.92:2380 --listen-peer-urls http://0.0.0.0:2380 
        --advertise-client-urls http://172.19.15.92:2379 --listen-client-urls http://0.0.0.0:2379 
        --initial-cluster-state new 
        --initial-cluster-token docker-etcd 
        --initial-cluster node1=http://172.19.15.92:2380,node2=http://172.19.15.93:2380,node3=http://172.19.15.94:2380

    # 节点node2

    docker run -d --name etcd --restart=always 
        -p 2379:2379 
        -p 2380:2380 
        kubernetes/etcd:v3.2.4 
        /usr/local/bin/etcd 
        --name node2 
        --initial-advertise-peer-urls http://172.19.15.93:2380 --listen-peer-urls http://0.0.0.0:2380 
        --advertise-client-urls http://172.19.15.93:2379 --listen-client-urls http://0.0.0.0:2379 
        --initial-cluster-state new 
        --initial-cluster-token docker-etcd 
        --initial-cluster node1=http://172.19.15.92:2380,node2=http://172.19.15.93:2380,node3=http://172.19.15.94:2380

    # 节点node3

    docker run -d --name etcd --restart=always 
        -p 2379:2379 
        -p 2380:2380 
        kubernetes/etcd:v3.2.4 
        /usr/local/bin/etcd 
        --name node3 
        --initial-advertise-peer-urls http://172.19.15.94:2380 --listen-peer-urls http://0.0.0.0:2380 
        --advertise-client-urls http://172.19.15.94:2379 --listen-client-urls http://0.0.0.0:2379 
        --initial-cluster-state new 
        --initial-cluster-token docker-etcd 
        --initial-cluster node1=http://172.19.15.92:2380,node2=http://172.19.15.93:2380,node3=http://172.19.15.94:2380

    # 配置网络

    1 [root@k8s ~]# docker exec etcd etcdctl set /k8s/network/config '{"Network":"192.100.0.1/16"}'
    2 {"Network":"192.100.0.1/16"}

    # 查看 etcd 成员

    1 [root@k8s ~]# docker exec etcd etcdctl member list
    2 14a0991cbae18c78: name=node3 peerURLs=http://172.19.15.94:2380 clientURLs=http://172.19.15.94:2379 isLeader=false
    3 33a95350dcc12573: name=node1 peerURLs=http://172.19.15.92:2380 clientURLs=http://172.19.15.92:2379 isLeader=true
    4 6cb8872859c66c95: name=node2 peerURLs=http://172.19.15.93:2380 clientURLs=http://172.19.15.93:2379 isLeader=false

    # 查看 etcd 健康状态

    1 [root@k8s ~]# docker exec etcd etcdctl cluster-health
    2 member 14a0991cbae18c78 is healthy: got healthy result from http://172.19.15.94:2379
    3 member 33a95350dcc12573 is healthy: got healthy result from http://172.19.15.92:2379
    4 member 6cb8872859c66c95 is healthy: got healthy result from http://172.19.15.93:2379
    5 cluster is healthy

    # docker 命令行启动

    1 /usr/bin/dockerd --registry-mirror=http://f2d6cb40.m.daocloud.io --bip=192.100.68.1/24
  • 相关阅读:
    php面试专题---16、MySQL创建高性能索引考点
    php面试专题---Mysql索引类型、介绍及优点
    php面试专题---Mysql索引原理及SQL优化
    北风设计模式课程---责任链模式 总结
    黑马lavarel教程---2、获取用户输入
    php面试专题---15、MySQL数据库基础考察点
    北风设计模式课程---外观模式、代理模式和中介者模式的区别
    legend3---1、meedu安装
    mysql中utf8和utf8mb4区别
    Struts2基于注解的Action配置
  • 原文地址:https://www.cnblogs.com/wangjq19920210/p/9267893.html
Copyright © 2011-2022 走看看