From 01e39a16acf4ac523575058f1c0ec4f44b199b97 Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Fri, 7 Apr 2017 01:19:36 +0100 Subject: [PATCH] demo: Tweak etcd start script Try joining a new cluster initially. If that fails try to join an existing cluster. Signed-off-by: Rolf Neugebauer --- projects/demo/etcd/etcd.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/projects/demo/etcd/etcd.sh b/projects/demo/etcd/etcd.sh index a2d6ad05e..8003145d9 100755 --- a/projects/demo/etcd/etcd.sh +++ b/projects/demo/etcd/etcd.sh @@ -29,3 +29,18 @@ NAME=infra${NUM} --initial-cluster-token etcd-cluster-1 \ --initial-cluster infra200=http://${PREFIX}.200:2380,infra201=http://${PREFIX}.201:2380,infra202=http://${PREFIX}.202:2380 \ --initial-cluster-state new + +echo "Returned $?" + +# If we get here, joining a new cluster failed. Let's try joining an +# existing cluster +/usr/local/bin/etcd \ + --name ${NAME} \ + --debug \ + --log-package-levels etcdmain=DEBUG,etcdserver=DEBUG \ + --initial-advertise-peer-urls http://${IP}:2380 \ + --listen-peer-urls http://${IP}:2380 \ + --listen-client-urls http://${IP}:2379,http://127.0.0.1:2379 \ + --advertise-client-urls http://${IP}:2379 \ + --initial-cluster infra200=http://${PREFIX}.200:2380,infra201=http://${PREFIX}.201:2380,infra202=http://${PREFIX}.202:2380 \ + --initial-cluster-state existing