Skip to content

Commit d23ff85

Browse files
weekfaceonlymellb
authored and
onlymellb
committed
fix join script (#285)
* fix join script
1 parent 4f5c8c1 commit d23ff85

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

charts/tidb-cluster/templates/scripts/_start_pd.sh.tpl

+10-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,16 @@ ARGS="--data-dir=/var/lib/pd \
6262
--config=/etc/pd/pd.toml \
6363
"
6464

65-
if [[ ! -f /var/lib/pd/join && ! -d /var/lib/pd/member/wal ]]
65+
if [[ -f /var/lib/pd/join ]]
66+
then
67+
# The content of the join file is:
68+
# 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
69+
# The --join args must be:
70+
# --join=http://demo-pd-0.demo-pd-peer.demo.svc:2380,http://demo-pd-1.demo-pd-peer.demo.svc:2380
71+
join=`cat /var/lib/pd/join | tr "," "\n" | awk -F'=' '{print $2}' | tr "\n" ","`
72+
join=${join%,}
73+
ARGS="${ARGS} --join=${join}"
74+
elif [[ ! -d /var/lib/pd/member/wal ]]
6675
then
6776
until result=$(wget -qO- -T 3 http://${discovery_url}/new/${encoded_domain_url} 2>/dev/null); do
6877
echo "waiting for discovery service returns start args ..."

0 commit comments

Comments
 (0)