Skip to content

Commit

Permalink
[FLINK-10215]Add configuration of java option for historyserver
Browse files Browse the repository at this point in the history
This closes apache#6612.
  • Loading branch information
liuxianjiao authored and tillrohrmann committed Sep 17, 2018
1 parent 4f219f4 commit 92b914c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/_includes/generated/environment_configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
<td style="word-wrap: break-word;">(none)</td>
<td></td>
</tr>
<tr>
<td><h5>env.java.opts.historyserver</h5></td>
<td style="word-wrap: break-word;">(none)</td>
<td>Java options to start the JVM of the HistoryServer with.</td>
</tr>
<tr>
<td><h5>env.java.opts.jobmanager</h5></td>
<td style="word-wrap: break-word;">(none)</td>
Expand Down
2 changes: 1 addition & 1 deletion docs/monitoring/application_profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ under the License.

Each standalone JobManager, TaskManager, HistoryServer, and ZooKeeper daemon redirects `stdout` and `stderr` to a file
with a `.out` filename suffix and writes internal logging to a file with a `.log` suffix. Java options configured by the
user in `env.java.opts`, `env.java.opts.jobmanager`, and `env.java.opts.taskmanager` can likewise define log files with
user in `env.java.opts`, `env.java.opts.jobmanager`, `env.java.opts.taskmanager` and `env.java.opts.historyserver` can likewise define log files with
use of the script variable `FLINK_LOG_PREFIX` and by enclosing the options in double quotes for late evaluation. Log files
using `FLINK_LOG_PREFIX` are rotated along with the default `.out` and `.log` files.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.flink.annotation.docs.ConfigGroup;
import org.apache.flink.annotation.docs.ConfigGroups;
import org.apache.flink.annotation.docs.Documentation;
import org.apache.flink.configuration.description.Description;

import static org.apache.flink.configuration.ConfigOptions.key;

Expand Down Expand Up @@ -140,6 +141,11 @@ public static String[] getParentFirstLoaderPatterns(Configuration config) {
.key("env.java.opts.taskmanager")
.defaultValue("");

public static final ConfigOption<String> FLINK_HS_JVM_OPTIONS = ConfigOptions
.key("env.java.opts.historyserver")
.defaultValue("")
.withDescription(Description.builder().text("Java options to start the JVM of the HistoryServer with.").build());

/**
* This options is here only for documentation generation, it is only
* evaluated in the shell scripts.
Expand Down
8 changes: 8 additions & 0 deletions flink-dist/src/main/flink-bin/bin/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ DEFAULT_ENV_LOG_MAX=5 # Maximum number of old log
DEFAULT_ENV_JAVA_OPTS="" # Optional JVM args
DEFAULT_ENV_JAVA_OPTS_JM="" # Optional JVM args (JobManager)
DEFAULT_ENV_JAVA_OPTS_TM="" # Optional JVM args (TaskManager)
DEFAULT_ENV_JAVA_OPTS_HS="" # Optional JVM args (HistoryServer)
DEFAULT_ENV_SSH_OPTS="" # Optional SSH parameters running in cluster mode
DEFAULT_YARN_CONF_DIR="" # YARN Configuration Directory, if necessary
DEFAULT_HADOOP_CONF_DIR="" # Hadoop Configuration Directory, if necessary
Expand Down Expand Up @@ -128,6 +129,7 @@ KEY_ENV_JAVA_HOME="env.java.home"
KEY_ENV_JAVA_OPTS="env.java.opts"
KEY_ENV_JAVA_OPTS_JM="env.java.opts.jobmanager"
KEY_ENV_JAVA_OPTS_TM="env.java.opts.taskmanager"
KEY_ENV_JAVA_OPTS_HS="env.java.opts.historyserver"
KEY_ENV_SSH_OPTS="env.ssh.opts"
KEY_HIGH_AVAILABILITY="high-availability"
KEY_ZK_HEAP_MB="zookeeper.heap.mb"
Expand Down Expand Up @@ -485,6 +487,12 @@ if [ -z "${FLINK_ENV_JAVA_OPTS_TM}" ]; then
FLINK_ENV_JAVA_OPTS_TM="$( echo "${FLINK_ENV_JAVA_OPTS_TM}" | sed -e 's/^"//' -e 's/"$//' )"
fi

if [ -z "${FLINK_ENV_JAVA_OPTS_HS}" ]; then
FLINK_ENV_JAVA_OPTS_HS=$(readFromConfig ${KEY_ENV_JAVA_OPTS_HS} "${DEFAULT_ENV_JAVA_OPTS_HS}" "${YAML_CONF}")
# Remove leading and ending double quotes (if present) of value
FLINK_ENV_JAVA_OPTS_HS="$( echo "${FLINK_ENV_JAVA_OPTS_HS}" | sed -e 's/^"//' -e 's/"$//' )"
fi

if [ -z "${FLINK_SSH_OPTS}" ]; then
FLINK_SSH_OPTS=$(readFromConfig ${KEY_ENV_SSH_OPTS} "${DEFAULT_ENV_SSH_OPTS}" "${YAML_CONF}")
fi
Expand Down
1 change: 1 addition & 0 deletions flink-dist/src/main/flink-bin/bin/historyserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ bin=`cd "$bin"; pwd`
. "$bin"/config.sh

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

Expand Down

0 comments on commit 92b914c

Please sign in to comment.