14

etcd本地集群部署

 3 years ago
source link: https://studygolang.com/articles/32150
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

etcd本地集群部署

哈里斯s · 大约10小时之前 · 28 次点击 · 预计阅读时间 2 分钟 · 不到1分钟之前 开始浏览    

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


有疑问加站长微信联系(非本文作者)

280

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK