diff --git a/bin/zeppelin-daemon.sh b/bin/zeppelin-daemon.sh index 6bdc1d245d3..f70db54e4cf 100755 --- a/bin/zeppelin-daemon.sh +++ b/bin/zeppelin-daemon.sh @@ -93,6 +93,26 @@ function initialize_default_directories() { echo "Pid dir doesn't exist, create ${ZEPPELIN_PID_DIR}" $(mkdir -p "${ZEPPELIN_PID_DIR}") fi + + PORT_NUMBER="8080" + ZEPPELIN_SITE="conf/zeppelin-site.xml" + ZEPPELIN_ENV="conf/zeppelin-env.sh" + if [ -e "${ZEPPELIN_SITE}" ]; then + PORT_NUMBER="$(xmllint --xpath 'string(//configuration/property[@name="zeppelin.server.port"]/value)' conf/zeppelin-site.xml)" + fi + + + if [ -e "${ZEPPELIN_ENV}" ]; then + PORT_LINE="$(cat conf/zeppelin-env.sh | grep ZEPPELIN_PORT | xargs)" + if [[ ! ${#PORT_LINE} -lt 0 ]]; then + if [[ $PORT_LINE != \#* ]]; then + PORT_NUMBER="$(cat conf/zeppelin-env.sh | grep ZEPPELIN_PORT | cut -d '=' -f2)" + fi + fi + fi + + IP_ADDR="$(ifconfig en0 | grep inet | grep -v inet6 | cut -d ' ' -f2)" + echo -e "Browse $IP_ADDR:$PORT_NUMBER in your browser.\nIf you are testing on your local computer, use localhost:$PORT_NUMBER" } function wait_for_zeppelin_to_die() { diff --git a/bin/zeppelin.sh b/bin/zeppelin.sh index 92d7f7ead96..a5dce102560 100755 --- a/bin/zeppelin.sh +++ b/bin/zeppelin.sh @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# Run Zeppelin +# Run Zeppelin # USAGE="Usage: bin/zeppelin.sh [--config ]" @@ -46,7 +46,7 @@ fi HOSTNAME=$(hostname) ZEPPELIN_LOGFILE="${ZEPPELIN_LOG_DIR}/zeppelin-${ZEPPELIN_IDENT_STRING}-${HOSTNAME}.log" LOG="${ZEPPELIN_LOG_DIR}/zeppelin-cli-${ZEPPELIN_IDENT_STRING}-${HOSTNAME}.out" - + ZEPPELIN_SERVER=org.apache.zeppelin.server.ZeppelinServer JAVA_OPTS+=" -Dzeppelin.log.file=${ZEPPELIN_LOGFILE}" @@ -87,4 +87,23 @@ if [[ ! -d "${ZEPPELIN_NOTEBOOK_DIR}" ]]; then $(mkdir -p "${ZEPPELIN_NOTEBOOK_DIR}") fi +PORT_NUMBER="8080" +ZEPPELIN_SITE="conf/zeppelin-site.xml" +ZEPPELIN_ENV="conf/zeppelin-env.sh" +if [ -e "${ZEPPELIN_SITE}" ]; then + PORT_NUMBER="$(xmllint --xpath 'string(//configuration/property[@name="zeppelin.server.port"]/value)' conf/zeppelin-site.xml)" +fi + + +if [ -e "${ZEPPELIN_ENV}" ]; then + PORT_LINE="$(cat conf/zeppelin-env.sh | grep ZEPPELIN_PORT | xargs)" + if [[ ! ${#PORT_LINE} -lt 0 ]]; then + if [[ $PORT_LINE != \#* ]]; then + PORT_NUMBER="$(cat conf/zeppelin-env.sh | grep ZEPPELIN_PORT | cut -d '=' -f2)" + fi + fi +fi + +IP_ADDR="$(ifconfig en0 | grep inet | grep -v inet6 | cut -d ' ' -f2)" +echo -e "Browse $IP_ADDR:$PORT_NUMBER in your browser.\nIf you are testing on your local computer, use localhost:$PORT_NUMBER" exec $ZEPPELIN_RUNNER $JAVA_OPTS -cp $ZEPPELIN_CLASSPATH_OVERRIDES:$CLASSPATH $ZEPPELIN_SERVER "$@" diff --git a/conf/zeppelin-site.xml.template b/conf/zeppelin-site.xml.template index 9386fd78eba..3d9e8f63b72 100755 --- a/conf/zeppelin-site.xml.template +++ b/conf/zeppelin-site.xml.template @@ -19,13 +19,13 @@ - + zeppelin.server.addr 0.0.0.0 Server address - + zeppelin.server.port 8080 Server port.