Skip to content

Commit aad813f

Browse files
authored
fix(docs): Update getting-started script pre-26.3.0 (#802)
* wait for nodes and crds, change to FQDN names as per integration test * corrected docs, improved wait condition
1 parent 8ab32e7 commit aad813f

3 files changed

Lines changed: 73 additions & 61 deletions

File tree

docs/modules/druid/examples/getting_started/getting_started.sh

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ then
2020
exit 1
2121
fi
2222

23+
echo "Waiting for node(s) to be ready..."
24+
kubectl wait node --all --for=condition=Ready --timeout=120s
25+
2326
cd "$(dirname "$0")"
2427

2528
case "$1" in
@@ -52,6 +55,9 @@ exit 1
5255
;;
5356
esac
5457

58+
# TODO: Remove once https://github.com/stackabletech/issues/issues/828 has been implemented (see that issue for details).
59+
until kubectl get crd druidclusters.druid.stackable.tech >/dev/null 2>&1; do echo "Waiting for CRDs to be installed" && sleep 1; done
60+
5561
echo "Installing ZooKeeper from zookeeper.yaml"
5662
# tag::install-zookeeper[]
5763
kubectl apply -f zookeeper.yaml
@@ -89,9 +95,9 @@ done
8995

9096
echo "Awaiting HDFS rollout finish"
9197
# tag::watch-hdfs-rollout[]
92-
kubectl rollout status --watch statefulset/simple-hdfs-datanode-default --timeout=300s
93-
kubectl rollout status --watch statefulset/simple-hdfs-journalnode-default --timeout=300s
94-
kubectl rollout status --watch statefulset/simple-hdfs-namenode-default --timeout=300s
98+
kubectl rollout status --watch statefulset/simple-hdfs-datanode-default --timeout=600s
99+
kubectl rollout status --watch statefulset/simple-hdfs-journalnode-default --timeout=600s
100+
kubectl rollout status --watch statefulset/simple-hdfs-namenode-default --timeout=600s
95101
# end::watch-hdfs-rollout[]
96102

97103
echo "Installing PostgreSQL for Druid"
@@ -125,39 +131,36 @@ done
125131

126132
echo "Awaiting Druid rollout finish"
127133
# tag::watch-druid-rollout[]
128-
kubectl rollout status --watch statefulset/simple-druid-broker-default --timeout=300s
129-
kubectl rollout status --watch statefulset/simple-druid-coordinator-default --timeout=300s
130-
kubectl rollout status --watch statefulset/simple-druid-historical-default --timeout=300s
131-
kubectl rollout status --watch statefulset/simple-druid-middlemanager-default --timeout=300s
132-
kubectl rollout status --watch statefulset/simple-druid-router-default --timeout=300s
134+
kubectl rollout status --watch statefulset/simple-druid-broker-default --timeout=600s
135+
kubectl rollout status --watch statefulset/simple-druid-coordinator-default --timeout=600s
136+
kubectl rollout status --watch statefulset/simple-druid-historical-default --timeout=600s
137+
kubectl rollout status --watch statefulset/simple-druid-middlemanager-default --timeout=600s
138+
kubectl rollout status --watch statefulset/simple-druid-router-default --timeout=600s
133139
# end::watch-druid-rollout[]
134140

135-
echo "Starting port-forwarding of port 9088"
136-
# shellcheck disable=2069 # we want all output to be blackholed
137-
# tag::port-forwarding[]
138-
kubectl port-forward svc/simple-druid-router 9088 > /dev/null 2>&1 &
139-
# end::port-forwarding[]
140-
PORT_FORWARD_PID=$!
141-
# shellcheck disable=2064 # we want the PID evaluated now, not at the time the trap is
142-
trap "kill $PORT_FORWARD_PID" EXIT
143-
sleep 5
141+
COORDINATOR="simple-druid-coordinator-default-headless.default.svc.cluster.local"
142+
BROKER="simple-druid-broker-default-headless.default.svc.cluster.local"
144143

145144
submit_job() {
146-
# tag::submit-job[]
147-
curl -s -k -X 'POST' -H 'Content-Type:application/json' -d @ingestion_spec.json https://localhost:9088/druid/indexer/v1/task
148-
# end::submit-job[]
145+
# tag::submit-job[]
146+
kubectl exec simple-druid-coordinator-default-0 -i -- \
147+
curl -s -k -X POST -H 'Content-Type:application/json' --data-binary @- \
148+
"https://${COORDINATOR}:8281/druid/indexer/v1/task" < ingestion_spec.json
149+
# end::submit-job[]
149150
}
150151

151152
echo "Submitting job"
152153
task_id=$(submit_job | sed -e 's/.*":"\([^"]\+\).*/\1/g')
153154

154155
request_job_status() {
155-
curl -s -k "https://localhost:9088/druid/indexer/v1/task/${task_id}/status" | sed -e 's/.*statusCode":"\([^"]\+\).*/\1/g'
156+
kubectl exec simple-druid-coordinator-default-0 -- \
157+
curl -s -k "https://${COORDINATOR}:8281/druid/indexer/v1/task/${task_id}/status" \
158+
| sed -e 's/.*statusCode":"\([^"]\+\).*/\1/g'
156159
}
157160

158161
while [ "$(request_job_status)" == "RUNNING" ]; do
159162
echo "Task still running..."
160-
sleep 5
163+
sleep 10
161164
done
162165

163166
task_status=$(request_job_status)
@@ -170,18 +173,22 @@ else
170173
fi
171174

172175
segment_load_status() {
173-
curl -s -k https://localhost:9088/druid/coordinator/v1/loadstatus | sed -e 's/.*wikipedia":\([0-9\.]\+\).*/\1/g'
176+
kubectl exec simple-druid-coordinator-default-0 -- \
177+
curl -s -k "https://${COORDINATOR}:8281/druid/coordinator/v1/loadstatus" \
178+
| sed -e 's/.*wikipedia":\([0-9\.]\+\).*/\1/g'
174179
}
175180

176181
while [ "$(segment_load_status)" != "100.0" ]; do
177182
echo "Segments still loading..."
178-
sleep 5
183+
sleep 10
179184
done
180185

181186
query_data() {
182-
# tag::query-data[]
183-
curl -s -k -X 'POST' -H 'Content-Type:application/json' -d @query.json https://localhost:9088/druid/v2/sql
184-
# end::query-data[]
187+
# tag::query-data[]
188+
kubectl exec simple-druid-broker-default-0 -i -- \
189+
curl -s -k -X POST -H 'Content-Type:application/json' --data-binary @- \
190+
"https://${BROKER}:8282/druid/v2/sql" < query.json
191+
# end::query-data[]
185192
}
186193

187194
echo "Querying data..."

docs/modules/druid/examples/getting_started/getting_started.sh.j2

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ then
2020
exit 1
2121
fi
2222

23+
echo "Waiting for node(s) to be ready..."
24+
kubectl wait node --all --for=condition=Ready --timeout=120s
25+
2326
cd "$(dirname "$0")"
2427

2528
case "$1" in
@@ -52,6 +55,9 @@ exit 1
5255
;;
5356
esac
5457

58+
# TODO: Remove once https://github.com/stackabletech/issues/issues/828 has been implemented (see that issue for details).
59+
until kubectl get crd druidclusters.druid.stackable.tech >/dev/null 2>&1; do echo "Waiting for CRDs to be installed" && sleep 1; done
60+
5561
echo "Installing ZooKeeper from zookeeper.yaml"
5662
# tag::install-zookeeper[]
5763
kubectl apply -f zookeeper.yaml
@@ -89,9 +95,9 @@ done
8995

9096
echo "Awaiting HDFS rollout finish"
9197
# tag::watch-hdfs-rollout[]
92-
kubectl rollout status --watch statefulset/simple-hdfs-datanode-default --timeout=300s
93-
kubectl rollout status --watch statefulset/simple-hdfs-journalnode-default --timeout=300s
94-
kubectl rollout status --watch statefulset/simple-hdfs-namenode-default --timeout=300s
98+
kubectl rollout status --watch statefulset/simple-hdfs-datanode-default --timeout=600s
99+
kubectl rollout status --watch statefulset/simple-hdfs-journalnode-default --timeout=600s
100+
kubectl rollout status --watch statefulset/simple-hdfs-namenode-default --timeout=600s
95101
# end::watch-hdfs-rollout[]
96102

97103
echo "Installing PostgreSQL for Druid"
@@ -125,39 +131,36 @@ done
125131

126132
echo "Awaiting Druid rollout finish"
127133
# tag::watch-druid-rollout[]
128-
kubectl rollout status --watch statefulset/simple-druid-broker-default --timeout=300s
129-
kubectl rollout status --watch statefulset/simple-druid-coordinator-default --timeout=300s
130-
kubectl rollout status --watch statefulset/simple-druid-historical-default --timeout=300s
131-
kubectl rollout status --watch statefulset/simple-druid-middlemanager-default --timeout=300s
132-
kubectl rollout status --watch statefulset/simple-druid-router-default --timeout=300s
134+
kubectl rollout status --watch statefulset/simple-druid-broker-default --timeout=600s
135+
kubectl rollout status --watch statefulset/simple-druid-coordinator-default --timeout=600s
136+
kubectl rollout status --watch statefulset/simple-druid-historical-default --timeout=600s
137+
kubectl rollout status --watch statefulset/simple-druid-middlemanager-default --timeout=600s
138+
kubectl rollout status --watch statefulset/simple-druid-router-default --timeout=600s
133139
# end::watch-druid-rollout[]
134140

135-
echo "Starting port-forwarding of port 9088"
136-
# shellcheck disable=2069 # we want all output to be blackholed
137-
# tag::port-forwarding[]
138-
kubectl port-forward svc/simple-druid-router 9088 > /dev/null 2>&1 &
139-
# end::port-forwarding[]
140-
PORT_FORWARD_PID=$!
141-
# shellcheck disable=2064 # we want the PID evaluated now, not at the time the trap is
142-
trap "kill $PORT_FORWARD_PID" EXIT
143-
sleep 5
141+
COORDINATOR="simple-druid-coordinator-default-headless.default.svc.cluster.local"
142+
BROKER="simple-druid-broker-default-headless.default.svc.cluster.local"
144143

145144
submit_job() {
146-
# tag::submit-job[]
147-
curl -s -k -X 'POST' -H 'Content-Type:application/json' -d @ingestion_spec.json https://localhost:9088/druid/indexer/v1/task
148-
# end::submit-job[]
145+
# tag::submit-job[]
146+
kubectl exec simple-druid-coordinator-default-0 -i -- \
147+
curl -s -k -X POST -H 'Content-Type:application/json' --data-binary @- \
148+
"https://${COORDINATOR}:8281/druid/indexer/v1/task" < ingestion_spec.json
149+
# end::submit-job[]
149150
}
150151

151152
echo "Submitting job"
152153
task_id=$(submit_job | sed -e 's/.*":"\([^"]\+\).*/\1/g')
153154

154155
request_job_status() {
155-
curl -s -k "https://localhost:9088/druid/indexer/v1/task/${task_id}/status" | sed -e 's/.*statusCode":"\([^"]\+\).*/\1/g'
156+
kubectl exec simple-druid-coordinator-default-0 -- \
157+
curl -s -k "https://${COORDINATOR}:8281/druid/indexer/v1/task/${task_id}/status" \
158+
| sed -e 's/.*statusCode":"\([^"]\+\).*/\1/g'
156159
}
157160

158161
while [ "$(request_job_status)" == "RUNNING" ]; do
159162
echo "Task still running..."
160-
sleep 5
163+
sleep 10
161164
done
162165

163166
task_status=$(request_job_status)
@@ -170,18 +173,22 @@ else
170173
fi
171174

172175
segment_load_status() {
173-
curl -s -k https://localhost:9088/druid/coordinator/v1/loadstatus | sed -e 's/.*wikipedia":\([0-9\.]\+\).*/\1/g'
176+
kubectl exec simple-druid-coordinator-default-0 -- \
177+
curl -s -k "https://${COORDINATOR}:8281/druid/coordinator/v1/loadstatus" \
178+
| sed -e 's/.*wikipedia":\([0-9\.]\+\).*/\1/g'
174179
}
175180

176181
while [ "$(segment_load_status)" != "100.0" ]; do
177182
echo "Segments still loading..."
178-
sleep 5
183+
sleep 10
179184
done
180185

181186
query_data() {
182-
# tag::query-data[]
183-
curl -s -k -X 'POST' -H 'Content-Type:application/json' -d @query.json https://localhost:9088/druid/v2/sql
184-
# end::query-data[]
187+
# tag::query-data[]
188+
kubectl exec simple-druid-broker-default-0 -i -- \
189+
curl -s -k -X POST -H 'Content-Type:application/json' --data-binary @- \
190+
"https://${BROKER}:8282/druid/v2/sql" < query.json
191+
# end::query-data[]
185192
}
186193

187194
echo "Querying data..."

docs/modules/druid/pages/getting_started/first_steps.adoc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,18 @@ simple-hdfs-namenode-default 2/2 6m
106106
simple-zk-server-default 3/3 7m
107107
----
108108

109-
Ideally you use `stackablectl stacklet list` to find out the address the Druid router is reachable at and use that address.
109+
=== Ingest example data
110110

111-
As an alternative, you can create a port-forward for the Druid Router:
111+
Next, ingest some example data using the web interface.
112+
You can either use `stackablectl stacklet list` to find out the address the Druid router is reachable at and use that address, or you can create a port-forward for the Druid Router:
112113

114+
[source,bash]
113115
----
114-
include::example$getting_started/getting_started.sh[tag=port-forwarding]
116+
kubectl port-forward svc/simple-druid-router 9088 > /dev/null 2>&1 &
115117
----
116118

117-
=== Ingest example data
118-
119-
Next, ingest some example data using the web interface.
120119
If you prefer to use the command line instead, follow the instructions in the collapsed section below.
121120

122-
123121
[#ingest-cmd-line]
124122
.Alternative: Using the command line
125123
[%collapsible]

0 commit comments

Comments
 (0)