Skip to content

Commit

Permalink
[FLINK-8091] [scripts] Support running historyserver in foreground
Browse files Browse the repository at this point in the history
This closes apache#5642
  • Loading branch information
Andreas Fink authored and StephanEwen committed Mar 9, 2018
1 parent 5eae8bd commit 69b3299
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/monitoring/historyserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ After you have configured the HistoryServer *and* JobManager, you start and stop

```sh
# Start or stop the HistoryServer
bin/historyserver.sh (start|stop)
bin/historyserver.sh (start|start-foreground|stop)
```

By default, this server binds to `localhost` and listens at port `8082`.
Expand Down
6 changes: 5 additions & 1 deletion flink-dist/src/main/flink-bin/bin/flink-console.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# Start a Flink service as a console application. Must be stopped with Ctrl-C
# or with SIGTERM by kill or the controlling process.
USAGE="Usage: flink-console.sh (jobmanager|taskmanager|zookeeper) [args]"
USAGE="Usage: flink-console.sh (jobmanager|taskmanager|historyserver|zookeeper) [args]"

SERVICE=$1
ARGS=("${@:2}") # get remaining arguments as array
Expand All @@ -42,6 +42,10 @@ case $SERVICE in
CLASS_TO_RUN=org.apache.flink.runtime.taskexecutor.TaskManagerRunner
;;

(historyserver)
CLASS_TO_RUN=org.apache.flink.runtime.webmonitor.history.HistoryServer
;;

(zookeeper)
CLASS_TO_RUN=org.apache.flink.runtime.zookeeper.FlinkZooKeeperQuorumPeer
;;
Expand Down
10 changes: 7 additions & 3 deletions flink-dist/src/main/flink-bin/bin/historyserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
################################################################################

# Start/stop a Flink HistoryServer
USAGE="Usage: historyserver.sh (start|stop)"
USAGE="Usage: historyserver.sh (start|start-foreground|stop)"

STARTSTOP=$1

Expand All @@ -27,8 +27,12 @@ bin=`cd "$bin"; pwd`

. "$bin"/config.sh

if [[ $STARTSTOP == "start" ]]; then
if [[ $STARTSTOP == "start" ]] || [[ $STARTSTOP == "start-foreground" ]]; then
args=("--configDir" "${FLINK_CONF_DIR}")
fi

"${FLINK_BIN_DIR}"/flink-daemon.sh $STARTSTOP historyserver "${args[@]}"
if [[ $STARTSTOP == "start-foreground" ]]; then
exec "${FLINK_BIN_DIR}"/flink-console.sh historyserver "${args[@]}"
else
"${FLINK_BIN_DIR}"/flink-daemon.sh $STARTSTOP historyserver "${args[@]}"
fi

0 comments on commit 69b3299

Please sign in to comment.