From 01ab5e3821e4f381b9f1a2c32b5948ffce141ef7 Mon Sep 17 00:00:00 2001 From: weekface Date: Tue, 26 Feb 2019 10:29:51 +0800 Subject: [PATCH 1/2] fix join script --- .../tidb-cluster/templates/scripts/_start_pd.sh.tpl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/charts/tidb-cluster/templates/scripts/_start_pd.sh.tpl b/charts/tidb-cluster/templates/scripts/_start_pd.sh.tpl index b02885366f..3dcf34e1e2 100644 --- a/charts/tidb-cluster/templates/scripts/_start_pd.sh.tpl +++ b/charts/tidb-cluster/templates/scripts/_start_pd.sh.tpl @@ -62,7 +62,16 @@ ARGS="--data-dir=/var/lib/pd \ --config=/etc/pd/pd.toml \ " -if [[ ! -f /var/lib/pd/join && ! -d /var/lib/pd/member/wal ]] +if [[ -f /var/lib/pd/join ]] +then + # The content of the join file is: + # demo-pd-0=http://demo-pd-0.demo-pd-peer.demo.svc:2380,demo-pd-1=http://demo-pd-1.demo-pd-peer.demo.svc:2380 + # The --join args must be: + # --join=http://demo-pd-0.demo-pd-peer.demo.svc:2380,http://demo-pd-1.demo-pd-peer.demo.svc:2380 + join=`cat /var/lib/pd/join | tr "," "\n" | awk -F'=' '{print $2}' | tr "\n" ","` + join=${join%?} + ARGS="${ARGS} --join=${join}" +elif [[ ! -d /var/lib/pd/member/wal ]] then until result=$(wget -qO- -T 3 http://${discovery_url}/new/${encoded_domain_url} 2>/dev/null); do echo "waiting for discovery service returns start args ..." From 3baaf684c5cbdcc34cb509a9e3667eeac0518d61 Mon Sep 17 00:00:00 2001 From: weekface Date: Tue, 26 Feb 2019 11:59:24 +0800 Subject: [PATCH 2/2] address comment --- charts/tidb-cluster/templates/scripts/_start_pd.sh.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/tidb-cluster/templates/scripts/_start_pd.sh.tpl b/charts/tidb-cluster/templates/scripts/_start_pd.sh.tpl index 3dcf34e1e2..53bba5a31b 100644 --- a/charts/tidb-cluster/templates/scripts/_start_pd.sh.tpl +++ b/charts/tidb-cluster/templates/scripts/_start_pd.sh.tpl @@ -69,7 +69,7 @@ then # The --join args must be: # --join=http://demo-pd-0.demo-pd-peer.demo.svc:2380,http://demo-pd-1.demo-pd-peer.demo.svc:2380 join=`cat /var/lib/pd/join | tr "," "\n" | awk -F'=' '{print $2}' | tr "\n" ","` - join=${join%?} + join=${join%,} ARGS="${ARGS} --join=${join}" elif [[ ! -d /var/lib/pd/member/wal ]] then