• etcd单机集群


    etcd在单机部署集群,可以先弄清楚配置文件参数的意思。起3个集成监听不同的端口号

    1. 启动

    在/etc/soft/etcd/node1文件夹中,创建脚本start1.sh

    etcd --name infra1 --initial-advertise-peer-urls http://127.0.0.1:2381 
      --listen-peer-urls http://127.0.0.1:2381 
        --listen-client-urls http://127.0.0.1:2379 
              --advertise-client-urls http://127.0.0.1:2379 
                --initial-cluster-token etcd-cluster-1 
                      --initial-cluster infra1=http://127.0.0.1:2381,infra2=http://127.0.0.1:2382,infra3=http://127.0.0.1:2383 
                        --initial-cluster-state new

    在/etc/soft/etcd/node2文件夹中,创建脚本start2.sh

    etcd --name infra2 --initial-advertise-peer-urls http://127.0.0.1:2382 
      --listen-peer-urls http://127.0.0.1:2382 
        --listen-client-urls http://127.0.0.1:2378 
              --advertise-client-urls http://127.0.0.1:2378 
                --initial-cluster-token etcd-cluster-1 
                      --initial-cluster infra1=http://127.0.0.1:2381,infra2=http://127.0.0.1:2382,infra3=http://127.0.0.1:2383 
                        --initial-cluster-state new

    在/etc/soft/etcd/node3文件夹中,创建脚本start3.sh

    etcd --name infra3 --initial-advertise-peer-urls http://127.0.0.1:2383 
      --listen-peer-urls http://127.0.0.1:2383 
        --listen-client-urls http://127.0.0.1:2377 
              --advertise-client-urls http://127.0.0.1:2377 
                --initial-cluster-token etcd-cluster-1 
                      --initial-cluster infra1=http://127.0.0.1:2381,infra2=http://127.0.0.1:2382,infra3=http://127.0.0.1:2383 
                        --initial-cluster-state new

    分别运行三个脚本

    2. 检查集群是否启动成功

    etcdctl --endpoint "http://127.0.0.1:2379" member list
    19ac17627e3e396f: name=infra2 peerURLs=http://127.0.0.1:2382 clientURLs=http://127.0.0.1:2378 isLeader=false
    8f65a5fdd9ee42ad: name=infra3 peerURLs=http://127.0.0.1:2383 clientURLs=http://127.0.0.1:2377 isLeader=true
    e7b968b9fb1bc003: name=infra1 peerURLs=http://127.0.0.1:2381 clientURLs=http://127.0.0.1:2379 isLeader=false
    etcdctl cluster-health
    member 19ac17627e3e396f is healthy: got healthy result from http://127.0.0.1:2378
    member 8f65a5fdd9ee42ad is healthy: got healthy result from http://127.0.0.1:2377
    member e7b968b9fb1bc003 is healthy: got healthy result from http://127.0.0.1:2379

    3个节点启动完成

  • 相关阅读:
    Codeforces Round#410 Div.2
    AtCoder Beginner Contest-060
    如何将gedit变成c++编译器
    洛谷 P2486 [SDOI2011]染色
    让lu哥头痛了许久的代码(洛谷:树的统计)
    字符串模拟入门
    luogu P1553 数字反转(升级版)
    那些令人难忘的——坑
    luogu P1341 无序字母对
    最短路相关题目
  • 原文地址:https://www.cnblogs.com/luckygxf/p/8698498.html
Copyright © 2020-2023  润新知