etcd集群搭建

mkdir -p /etc/etcd.d
mkdir -p /var/etcd/
mkdir -p /var/etcd/wal
vi /etc/etcd.d/etcd.conf
实例1配置文件
name: 'etcd1'
data-dir: '/var/etcd'
wal-log: '/var/etcd/wal'
snapshot-count: 10000
heartbeat-interval: 100
election-timeout: 1000
listen-peer-urls: 'http://0.0.0.0:2380'
listen-client-urls: 'http://0.0.0.0:2379'
max-snapshots: 5
max-wals: 5
cors:
initial-advertise-peer-urls: 'http://0.0.0.0:2380'
advertise-client-urls: 'http://0.0.0.0:2379'
initial-cluster: 'etcd1=http://172.17.0.10:2380,etcd2=http://172.17.0.11:2380,etcd3=http://172.17.0.12:2380'
initial-cluster-token: 'etcd'
initial-cluster-state: 'new'
strict-reconfig-check: false
enable-v3: true
enable-pprof: true
debug: false
logger: zap
log-outputs: [stderr]
实例2配置文件
name: 'etcd2'
data-dir: '/var/etcd'
wal-log: '/var/etcd/wal'
snapshot-count: 10000
heartbeat-interval: 100
election-timeout: 1000
listen-peer-urls: 'http://0.0.0.0:2380'
listen-client-urls: 'http://0.0.0.0:2379'
max-snapshots: 5
max-wals: 5
cors:
initial-advertise-peer-urls: 'http://0.0.0.0:2380'
advertise-client-urls: 'http://0.0.0.0:2379'
initial-cluster: 'etcd1=http://172.17.0.10:2380,etcd2=http://172.17.0.11:2380,etcd3=http://172.17.0.12:2380'
initial-cluster-token: 'etcd'
initial-cluster-state: 'new'
strict-reconfig-check: false
enable-v3: true
enable-pprof: true
debug: false
logger: zap
log-outputs: [stderr]

实例3配置文件
name: 'etcd3'
data-dir: '/var/etcd'
wal-log: '/var/etcd/wal'
snapshot-count: 10000
heartbeat-interval: 100
election-timeout: 1000
listen-peer-urls: 'http://0.0.0.0:2380'
listen-client-urls: 'http://0.0.0.0:2379'
max-snapshots: 5
max-wals: 5
cors:
initial-advertise-peer-urls: 'http://0.0.0.0:2380'
advertise-client-urls: 'http://0.0.0.0:2379'
initial-cluster: 'etcd1=http://172.17.0.10:2380,etcd2=http://172.17.0.11:2380,etcd3=http://172.17.0.12:2380'
initial-cluster-token: 'etcd'
initial-cluster-state: 'new'
strict-reconfig-check: false
enable-v3: true
enable-pprof: true
debug: false
logger: zap
log-outputs: [stderr]
启动
setsid etcd --config-file /etc/etcd.d/etcd.conf

查看集群节点