docker-compose安装etcd集群


 

etcd1 docker-compose.yml文件

version: '3.7'
services:
  etcd:
    container_name: etcd1
    image: registry.cn-hangzhou.aliyuncs.com/google_containers/etcd-amd64:3.3.10
    ports:
      - "2379:2379"
      - "2380:2380"
    network_mode: "host"
    restart: always
    stdin_open: true
    tty: true
    command: etcd --name etcd-srv1 --data-dir=/var/lib/etcd/ --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://192.168.80.4:2379 --initial-advertise-peer-urls http://192.168.80.4:2380 --listen-peer-urls http://0.0.0.0:2380 --initial-cluster-token etcd-cluster --initial-cluster "etcd-srv1=http://192.168.80.4:2380,etcd-srv2=http://192.168.80.5:2380,etcd-srv3=http://192.168.80.6:2380" --initial-cluster-state new
    volumes:
      - /var/lib/etcd:/var/lib/etcd

etcd2 docker-compose.yml文件

version: '3.7'
services:
  etcd:
    container_name: etcd2
    image: registry.cn-hangzhou.aliyuncs.com/google_containers/etcd-amd64:3.3.10
    ports:
      - "2379:2379"
      - "2380:2380"
    network_mode: "host"
    stdin_open: true
    restart: always
    tty: true
    command: etcd --name etcd-srv2 --data-dir=/var/lib/etcd/ --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://192.168.80.5:2379 --initial-advertise-peer-urls http://192.168.80.5:2380 --listen-peer-urls http://0.0.0.0:2380 --initial-cluster-token etcd-cluster --initial-cluster "etcd-srv1=http://192.168.80.4:2380,etcd-srv2=http://192.168.80.5:2380,etcd-srv3=http://192.168.80.6:2380" --initial-cluster-state new
    volumes:
      - /var/lib/etcd:/var/lib/etcd

etcd3 docker-compose.yml文件

version: '3.7'
services:
  etcd:
    container_name: etcd3
    image: registry.cn-hangzhou.aliyuncs.com/google_containers/etcd-amd64:3.3.10
    ports:
      - "2379:2379"
      - "2380:2380"
    network_mode: "host"
    stdin_open: true
    restart: always
    tty: true
    command: etcd --name etcd-srv3 --data-dir=/var/lib/etcd/ --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://192.168.80.6:2379 --initial-advertise-peer-urls http://192.168.80.6:2380 --listen-peer-urls http://0.0.0.0:2380 --initial-cluster-token etcd-cluster --initial-cluster "etcd-srv1=http://192.168.80.4:2380,etcd-srv2=http://192.168.80.5:2380,etcd-srv3=http://192.168.80.6:2380" --initial-cluster-state new
    volumes:
      - /var/lib/etcd:/var/lib/etcd
etcd三台集群服务器地址是:192.168.80.4 、192.168.80.5、192.168.80.6


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM