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