首页 > 其他 > 详细

Docker配置etcd集群

时间:2020-06-15 16:39:08      阅读:44      评论:0      收藏:0      [点我收藏+]

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

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

1、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

 

2、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

 

3、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 

技术分享图片

 

Docker配置etcd集群

原文:https://www.cnblogs.com/MinZhou/p/13131444.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!