github.com/qiuhoude/go-web@v0.0.0-20220223060959-ab545e78f20d/etcd/docker-compose.yml (about)

     1  version: "3.6"
     2  
     3  services:
     4    node1:
     5      image: quay.io/coreos/etcd:v3.4.0
     6      volumes:
     7        - node1-data:/etcd-data
     8      ports:
     9        - "2379:2379"
    10      expose:
    11        - 2379
    12        - 2380
    13      networks:
    14        cluster_net:
    15          ipv4_address: 172.16.238.100
    16      environment:
    17        - ETCDCTL_API=3
    18      command:
    19        - /usr/local/bin/etcd
    20        - --data-dir=/etcd-data
    21        - --name
    22        - node1
    23        - --initial-advertise-peer-urls
    24        - http://172.16.238.100:2380
    25        - --listen-peer-urls
    26        - http://0.0.0.0:2380
    27        - --advertise-client-urls
    28        - http://172.16.238.100:2379
    29        - --listen-client-urls
    30        - http://0.0.0.0:2379
    31        - --initial-cluster
    32        - node1=http://172.16.238.100:2380,node2=http://172.16.238.101:2380,node3=http://172.16.238.102:2380
    33        - --initial-cluster-state
    34        - new
    35        - --initial-cluster-token
    36        - docker-etcd
    37  
    38    node2:
    39      image: quay.io/coreos/etcd:v3.4.0
    40      volumes:
    41        - node2-data:/etcd-data
    42      expose:
    43        - 2379
    44        - 2380
    45      networks:
    46        cluster_net:
    47          ipv4_address: 172.16.238.101
    48      environment:
    49        - ETCDCTL_API=3
    50      command:
    51        - /usr/local/bin/etcd
    52        - --data-dir=/etcd-data
    53        - --name
    54        - node2
    55        - --initial-advertise-peer-urls
    56        - http://172.16.238.101:2380
    57        - --listen-peer-urls
    58        - http://0.0.0.0:2380
    59        - --advertise-client-urls
    60        - http://172.16.238.101:2379
    61        - --listen-client-urls
    62        - http://0.0.0.0:2379
    63        - --initial-cluster
    64        - node1=http://172.16.238.100:2380,node2=http://172.16.238.101:2380,node3=http://172.16.238.102:2380
    65        - --initial-cluster-state
    66        - new
    67        - --initial-cluster-token
    68        - docker-etcd
    69  
    70    node3:
    71      image: quay.io/coreos/etcd:v3.4.0
    72      volumes:
    73        - node3-data:/etcd-data
    74      expose:
    75        - 2379
    76        - 2380
    77      networks:
    78        cluster_net:
    79          ipv4_address: 172.16.238.102
    80      environment:
    81        - ETCDCTL_API=3
    82      command:
    83        - /usr/local/bin/etcd
    84        - --data-dir=/etcd-data
    85        - --name
    86        - node3
    87        - --initial-advertise-peer-urls
    88        - http://172.16.238.102:2380
    89        - --listen-peer-urls
    90        - http://0.0.0.0:2380
    91        - --advertise-client-urls
    92        - http://172.16.238.102:2379
    93        - --listen-client-urls
    94        - http://0.0.0.0:2379
    95        - --initial-cluster
    96        - node1=http://172.16.238.100:2380,node2=http://172.16.238.101:2380,node3=http://172.16.238.102:2380
    97        - --initial-cluster-state
    98        - new
    99        - --initial-cluster-token
   100        - docker-etcd
   101  
   102  volumes:
   103    node1-data:
   104    node2-data:
   105    node3-data:
   106  
   107  networks:
   108    cluster_net:
   109      driver: bridge
   110      ipam:
   111        driver: default
   112        config:
   113          - subnet: 172.16.238.0/24
   114  
   115  /usr/local/bin/etcdctl member list