0
点赞
收藏
分享

微信扫一扫

docker-compose 安装etcd集群

后来的六六 2022-05-21 阅读 56
version: "3.8"
networks:
etcdcluster:
name: etcdcluster
services:
node1:
image: quay.io/coreos/etcd:v3.4.14
ports:
- "12379:2379"
volumes:
- /etc/localtime:/etc/localtime
- /docker/etcd/node1/data:/var/etcd
command: >
/usr/local/bin/etcd
--name node1
--data-dir /var/etcd
--listen-client-urls http://0.0.0.0:2379
--advertise-client-urls http://0.0.0.0:2379
--listen-peer-urls http://0.0.0.0:2380
--initial-advertise-peer-urls http://node1:2380
--initial-cluster node1=http://node1:2380,node2=http://node2:2380,node3=http://node3:2380
--initial-cluster-token etcd-token
--initial-cluster-state new
--log-level info
networks:
- etcdcluster
node2:
image: quay.io/coreos/etcd:v3.4.14
ports:
- "22379:2379"
volumes:
- /etc/localtime:/etc/localtime
- /docker/etcd/node2/data:/var/etcd
command: >
/usr/local/bin/etcd
--name node2
--data-dir /var/etcd
--listen-client-urls http://0.0.0.0:2379
--advertise-client-urls http://0.0.0.0:2379
--listen-peer-urls http://0.0.0.0:2380
--initial-advertise-peer-urls http://node2:2380
--initial-cluster node1=http://node1:2380,node2=http://node2:2380,node3=http://node3:2380
--initial-cluster-token etcd-token
--initial-cluster-state new
--log-level info
networks:
- etcdcluster
node3:
image: quay.io/coreos/etcd:v3.4.14
ports:
- "32379:2379"
volumes:
- /etc/localtime:/etc/localtime
- /docker/etcd/node3/data:/var/etcd
command: >
/usr/local/bin/etcd
--name node3
--data-dir /var/etcd
--listen-client-urls http://0.0.0.0:2379
--advertise-client-urls http://0.0.0.0:2379
--listen-peer-urls http://0.0.0.0:2380
--initial-advertise-peer-urls http://node3:2380
--initial-cluster node1=http://node1:2380,node2=http://node2:2380,node3=http://node3:2380
--initial-cluster-token etcd-token
--initial-cluster-state new
--log-level info
networks:
- etcdcluster
举报

相关推荐

0 条评论