From d21e3628618d33c0557fae00989f85c4fce9c1a3 Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Fri, 15 Nov 2024 19:17:36 +0800 Subject: [PATCH] [ZEPPELIN-6150] `zeppelin.sh` shall respect HADOOP_HOME to find `hadoop` command ### What is this PR for? Obviously, `*_HOME` should be respected if they are present, otherwise fallback to find the command in `PATH`. ### What type of PR is it? Improvement ### What is the Jira issue? ZEPPELIN-6150 ### How should this be tested? Manually tested on a dev env, there are multiple Hadoop clients installed in one machine, and `hadoop` is not available in `PATH`, now I can set `HADOOP_HOME` to allow Zeppelin start. ### Screenshots (if appropriate) ### Questions: * Does the license files need to update? no * Is there breaking changes for older versions? might be * Does this needs documentation? no Closes #4899 from pan3793/ZEPPELIN-6150. Signed-off-by: Cheng Pan --- bin/zeppelin.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/zeppelin.sh b/bin/zeppelin.sh index efd3aae8b8a..9c1f7a9b41e 100755 --- a/bin/zeppelin.sh +++ b/bin/zeppelin.sh @@ -121,7 +121,9 @@ if [[ "${USE_HADOOP}" != "false" ]]; then echo "Please specify HADOOP_CONF_DIR if USE_HADOOP is true" else ZEPPELIN_CLASSPATH+=":${HADOOP_CONF_DIR}" - if ! [ -x "$(command -v hadoop)" ]; then + if [ -n "${HADOOP_HOME}" ]; then + ZEPPELIN_CLASSPATH+=":`${HADOOP_HOME}/bin/hadoop classpath`" + elif ! [ -x "$(command -v hadoop)" ]; then echo 'hadoop command is not in PATH when HADOOP_CONF_DIR is specified.' else ZEPPELIN_CLASSPATH+=":`hadoop classpath`"