美文网首页
etcd本地集群部署

etcd本地集群部署

作者: 哈里斯s | 来源:发表于2020-12-13 15:09 被阅读0次

准备工作

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

相关文章

网友评论

      本文标题:etcd本地集群部署

      本文链接:https://www.haomeiwen.com/subject/cmfpgktx.html