From 53fd227f5c2b888ffcf07e411c18301da40a7872 Mon Sep 17 00:00:00 2001 From: Vimal K Date: Wed, 4 Sep 2019 22:15:19 +0100 Subject: [PATCH] . : added Procfile.learner Added Procfile.learner to easily start cluster with learner Modified README.md to highlight its usage Update review comments --- Procfile | 2 ++ Procfile.learner | 11 +++++++++++ README.md | 6 ++++++ 3 files changed, 19 insertions(+) create mode 100644 Procfile.learner diff --git a/Procfile b/Procfile index 786d506c8..2272f2ff7 100644 --- a/Procfile +++ b/Procfile @@ -3,3 +3,5 @@ etcd1: bin/etcd --name infra1 --listen-client-urls http://127.0.0.1:2379 --adver etcd2: bin/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: bin/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 + +# A learner node can be started using Procfile.learner diff --git a/Procfile.learner b/Procfile.learner new file mode 100644 index 000000000..9e32487e7 --- /dev/null +++ b/Procfile.learner @@ -0,0 +1,11 @@ +# Use goreman to run `go get github.com/mattn/goreman` + +# 1. Start the cluster using Procfile +# 2. Add learner node to the cluster +# % etcdctl member add infra4 --peer-urls="http://127.0.0.1:42380" --learner=true + +# 3. Start learner node with goreman +etcd4: bin/etcd --name infra4 --listen-client-urls http://127.0.0.1:42379 --advertise-client-urls http://127.0.0.1:42379 --listen-peer-urls http://127.0.0.1:42380 --initial-advertise-peer-urls http://127.0.0.1:42380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra4=http://127.0.0.1:42380,infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state existing --enable-pprof --logger=zap --log-outputs=stderr + +# 4. The learner node can be promoted to voting member by the command +# % etcdctl member promote diff --git a/README.md b/README.md index 330c2fc00..655d31408 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,12 @@ This will bring up 3 etcd members `infra1`, `infra2` and `infra3` and etcd `grpc Every cluster member and proxy accepts key value reads and key value writes. +Follow the steps in [Procfile.learner](./Procfile.learner) to add a learner node to the cluster. Start the learner node with: + +```bash +goreman -f ./Procfile.learner start +``` + ### Next steps Now it's time to dig into the full etcd API and other guides.