zoukankan      html  css  js  c++  java
  • 使用docker配置etcd集群

    docker配置etcd集群与直接部署etcd集群在配置上并没有什么太大差别。

    我这里直接使用docker-compose来实现容器化的etcd部署

    环境如下:

    HostName IP
    etcd1 10.1.61.175
    etcd2 10.1.61.176
    etcd3 10.1.61.177

    etcd1上的docker-compose.yaml内容如下:

    version: "2"
    services:
      etcd:
        image: hub.dz11.com/library/etcd-amd64:3.1.10
        restart: always
        network_mode: host
        volumes:
          - "/home/www/server/etcd:/data/etcd"
          - "/etc/localtime:/etc/localtime"
        environment:
          ETCDCTL_API: "3"
        command: etcd  -name etcd1 -data-dir /data/etcd -advertise-client-urls http://10.1.61.175:2379 -listen-client-urls http://10.1.61.175:2379,http://127.0.0.1:2379 -initial-advertise-peer-urls http://10.1.61.175:2380 -listen-peer-urls http://0.0.0.0:2380 -initial-cluster-token etcd-cluster-1 -initial-cluster etcd1=http://10.1.61.175:2380,etcd2=http://10.1.61.176:2380,etcd3=http://10.1.61.177:2380 -initial-cluster-state new
    
    

    etcd2上的docker-compose.yaml内容如下:

    version: "2"
    services:
      etcd:
        image: hub.dz11.com/library/etcd-amd64:3.1.10
        restart: always
        network_mode: host
        volumes:
          - "/home/www/server/etcd:/data/etcd"
          - "/etc/localtime:/etc/localtime"
        environment:
          ETCDCTL_API: "3"
        command: etcd  -name etcd2 -data-dir /data/etcd -advertise-client-urls http://10.1.61.176:2379 -listen-client-urls http://10.1.61.176:2379,http://127.0.0.1:2379 -initial-advertise-peer-urls http://10.1.61.176:2380 -listen-peer-urls http://0.0.0.0:2380 -initial-cluster-token etcd-cluster-1 -initial-cluster etcd1=http://10.1.61.175:2380,etcd2=http://10.1.61.176:2380,etcd3=http://10.1.61.177:2380 -initial-cluster-state new
    
    

    etcd3上的docker-compose.yaml内容如下:

    version: "2"
    services:
      etcd:
        image: dk-reg.op.douyuyuba.com/library/etcd-amd64:3.1.10
        restart: always
        network_mode: host
        volumes:
          - "/home/www/server/etcd:/data/etcd"
          - "/etc/localtime:/etc/localtime"
        environment:
          ETCDCTL_API: "3"
        command: etcd  -name etcd3 -data-dir /data/etcd -advertise-client-urls http://10.1.61.177:2379 -listen-client-urls http://10.1.61.177:2379,http://127.0.0.1:2379 -initial-advertise-peer-urls http://10.1.61.177:2380 -listen-peer-urls http://0.0.0.0:2380 -initial-cluster-token etcd-cluster-1 -initial-cluster etcd1=http://10.1.61.175:2380,etcd2=http://10.1.61.176:2380,etcd3=http://10.1.61.177:2380 -initial-cluster-state new
    

    启动docker-compose:

    docker-compose up -d 
    
  • 相关阅读:
    [05] EL表达式
    [03-01] JSP自定义标签
    [04] JSP标准动作
    [03] JSP指令
    Fiddler抓包调试前端脚本代码
    《互联网协议入门》思维导图笔记
    Nodejs学习笔记(十)—与MongoDB的交互(mongodb/node-mongodb-native)、MongoDB入门
    Nodejs学习笔记(九)—与Redis的交互(mranney/node_redis)入门
    Nodejs学习笔记(八)—Node.js + Express 实现上传文件功能(felixge/node-formidable)
    Nodejs学习笔记(七)—Node.js + Express 构建网站简单示例
  • 原文地址:https://www.cnblogs.com/breezey/p/8847418.html
Copyright © 2011-2022 走看看