etcd集群学习-在单机部署
作者:互联网
https://github.com/etcd-io/etcd/tags
etcd1
mkdir -p /usr/local/etcd1/{conf,data}
# cat /usr/local/etcd1/conf/etcd1.yaml
name: etcd1
data-dir: /usr/local/etcd1/data
listen-client-urls: 'http://192.168.229.182:9012'
advertise-client-urls: 'http://192.168.229.182:9012'
listen-peer-urls: 'http://192.168.229.182:9011'
initial-advertise-peer-urls: 'http://192.168.229.182:9011'
initial-cluster:
etcd1=http://192.168.229.182:9011,etcd2=http://192.168.229.182:9013,etcd3=http://192.168.229.182:9015
initial-cluster-token: etcd-cluster-1
initial-cluster-state: new
etcd2
mkdir -p /usr/local/etcd2/{conf,data}
# cat /usr/local/etcd2/conf/etcd2.yaml
name: etcd2
data-dir: /usr/local/etcd2/data
listen-client-urls: 'http://192.168.229.182:9014'
advertise-client-urls: 'http://192.168.229.182:9014'
listen-peer-urls: 'http://192.168.229.182:9013'
initial-advertise-peer-urls: 'http://192.168.229.182:9013'
initial-cluster:
etcd1=http://192.168.229.182:9011,etcd2=http://192.168.229.182:9013,etcd3=http://192.168.229.182:9015
initial-cluster-token: etcd-cluster-1
initial-cluster-state: new
etcd3
mkdir -p /usr/local/etcd3/{conf,data}
# cat /usr/local/etcd3/conf/etcd3.yaml
name: etcd3
data-dir: /usr/local/etcd3/data
listen-client-urls: 'http://192.168.229.182:9016'
advertise-client-urls: 'http://192.168.229.182:9016'
listen-peer-urls: 'http://192.168.229.182:9015'
initial-advertise-peer-urls: 'http://192.168.229.182:9015'
initial-cluster:
etcd1=http://192.168.229.182:9011,etcd2=http://192.168.229.182:9013,etcd3=http://192.168.229.182:9015
initial-cluster-token: etcd-cluster-1
initial-cluster-state: new
启动
# /usr/bin/etcd --config-file=/usr/local/etcd1/conf/etcd1.yaml &
# /usr/bin/etcd --config-file=/usr/local/etcd2/conf/etcd2.yaml &
# /usr/bin/etcd --config-file=/usr/local/etcd3/conf/etcd3.yaml &
# etcdctl --endpoints http://192.168.229.182:9012,http://192.168.229.182:9014,http://192.168.229.182:9016 member list
204139eabcab2dcc: name=etcd3 peerURLs=http://192.168.229.182:9015 clientURLs=http://192.168.229.182:9016 isLeader=false
64098b532ae66b2c: name=etcd2 peerURLs=http://192.168.229.182:9013 clientURLs=http://192.168.229.182:9014 isLeader=false
bb180fc0988a5c78: name=etcd1 peerURLs=http://192.168.229.182:9011 clientURLs=http://192.168.229.182:9012 isLeader=true
标签:http,单机,192.168,229.182,cluster,集群,usr,etcd,local 来源: https://www.cnblogs.com/jiazhoufei/p/16440283.html