etcd本地集群部署

2020-12-13  本文已影响0人  哈里斯s

准备工作

golang环境

etcd地址:https://github.com/etcd-io/etcd

goreman: https://github.com/mattn/goreman

集群搭建

1,安装goreman

# go get github.com/mattn/goreman

2, 创建Procfile文件,一共3个节点,内容如下:

etcd1: etcd--nameinfra1--listen-client-urlshttp://127.0.0.1:12379--advertise-client-urlshttp://127.0.0.1:12379--listen-peer-urlshttp://127.0.0.1:12380--initial-advertise-peer-urlshttp://127.0.0.1:12380--initial-cluster-tokenetcd-cluster-1--initial-cluster'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380'--initial-cluster-statenew--enable-pprof--logger=zap--log-outputs=stderr

etcd2: etcd--nameinfra2--listen-client-urlshttp://127.0.0.1:22379--advertise-client-urlshttp://127.0.0.1:22379--listen-peer-urlshttp://127.0.0.1:22380--initial-advertise-peer-urlshttp://127.0.0.1:22380--initial-cluster-tokenetcd-cluster-1--initial-cluster'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380'--initial-cluster-statenew--enable-pprof--logger=zap--log-outputs=stderr

etcd3: etcd--nameinfra3--listen-client-urlshttp://127.0.0.1:32379--advertise-client-urlshttp://127.0.0.1:32379--listen-peer-urlshttp://127.0.0.1:32380--initial-advertise-peer-urlshttp://127.0.0.1:32380--initial-cluster-tokenetcd-cluster-1--initial-cluster'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380'--initial-cluster-statenew--enable-pprof--logger=zap--log-outputs=stderr

3,启动集群

# goreman -f Procfile start

4, 停止某个节点

# goreman run stop etcd1

5, 启动某个节点

# goreman run restart etcd1

上一篇 下一篇

猜你喜欢

热点阅读