下载安装gotrman
mattn/goreman: foreman clone written in go language (github.com)
1
| go install github.com/mattn/goreman@latest
|
下载etcd的二进制文件,我用的是3.5.0版本
Release v3.5.0 · etcd-io/etcd (github.com)
把etcd的二进制文件,加入到全局path /usr/local/bin
1 2
| ln -s /root/etcd/etcd-v3.5.0-linux-amd64/etcdctl /usr/local/bin/etcdctl ln -s /root/etcd/etcd-v3.5.0-linux-amd64/etcd /usr/local/bin/etcd
|
(也可以mv过去)
创建一个文件Procfile
来源 etcd/Procfile at v3.5.0 · etcd-io/etcd (github.com)
修改了bin/etcd 为 etcd
1 2 3 4 5
| # Use goreman to run `go get github.com/mattn/goreman` etcd1: etcd --name infra1 --listen-client-urls http://127.0.0.1:2379 --advertise-client-urls http://127.0.0.1:2379 --listen-peer-urls http://127.0.0.1:12380 --initial-advertise-peer-urls http://127.0.0.1:12380 --initial-cluster-token etcd-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-state new --enable-pprof --logger=zap --log-outputs=stderr etcd2: etcd --name infra2 --listen-client-urls http://127.0.0.1:22379 --advertise-client-urls http://127.0.0.1:22379 --listen-peer-urls http://127.0.0.1:22380 --initial-advertise-peer-urls http://127.0.0.1:22380 --initial-cluster-token etcd-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-state new --enable-pprof --logger=zap --log-outputs=stderr etcd3: etcd --name infra3 --listen-client-urls http://127.0.0.1:32379 --advertise-client-urls http://127.0.0.1:32379 --listen-peer-urls http://127.0.0.1:32380 --initial-advertise-peer-urls http://127.0.0.1:32380 --initial-cluster-token etcd-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-state new --enable-pprof --logger=zap --log-outputs=stderr #proxy: bin/etcd grpc-proxy start --endpoints=127.0.0.1:2379,127.0.0.1:22379,127.0.0.1:32379 --listen-addr=127.0.0.1:23790 --advertise-client-url=127.0.0.1:23790 --enable-pprof
|
使用goreman快速启动三个etcd节点
1
| goreman -f Procfile start
|

测试
