This is an automated email from the ASF dual-hosted git repository. xxyu pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/kylin.git
The following commit(s) were added to refs/heads/main by this push: new b4c857e KYLIN-5083, check hdfs service usability for kylin4 on docker b4c857e is described below commit b4c857eda293a9a71e4f3e0841e62ef49cbe66c0 Author: Mukvin <boyboys...@163.com> AuthorDate: Wed Sep 8 15:27:42 2021 +0800 KYLIN-5083, check hdfs service usability for kylin4 on docker --- docker/dockerfile/standalone/entrypoint.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docker/dockerfile/standalone/entrypoint.sh b/docker/dockerfile/standalone/entrypoint.sh index c7e642a..35e3bf2 100644 --- a/docker/dockerfile/standalone/entrypoint.sh +++ b/docker/dockerfile/standalone/entrypoint.sh @@ -63,8 +63,31 @@ mkdir -p ${KYLIN_HOME}/logs # check hive usability first, this operation will insert one version record into VERSION table $KYLIN_HOME/bin/check-hive-usability.sh > ${KYLIN_HOME}/logs/kylin-verbose.log 2>&1 +function check_hdfs_usability() { + echo "Checking HDFS's service..." + started_hdfs= + ((time_left = 60)) + while ((time_left > 0)); do + hdfs dfs -test -d /tmp + started_hdfs=$? + if [[ $started_hdfs -eq 0 ]]; then + break + fi + sleep 5 + ((timeLeft -= 5)) + done + if [[ $started_hdfs -eq 0 ]]; then + echo "HDFS's service started..." + else + echo "ERROR: Check HDFS's service failed, please check the status of your cluster" + fi +} + if [ ! -f "/home/admin/first_run" ] then + # check hdfs usability first if hdfs service was not started normally + check_hdfs_usability + hdfs dfs -mkdir -p /kylin4/spark-history hdfs dfs -mkdir -p /spark2_jars hdfs dfs -put -f $SPARK_HOME/jars/* hdfs://localhost:9000/spark2_jars/