Acceldata
ODP

Last updated: Oct 16, 2026 14:08 UTC

Hive

Update the Hive Java 17 flags as shown below.

Advanced tez-env -> hive-env

File location: Log into the Ambari UI and navigate to hive -> configs -> Advanced ->Advanced hive-env >hive-env template.


# The heap size of the jvm, and jvm args stared by hive shell script can be controlled via:
if [ "$SERVICE" = "metastore" ]; then
 export HADOOP_HEAPSIZE={{hive_metastore_heapsize}} # Setting for HiveMetastore
 {% if java_version == 8 %}
 export HADOOP_OPTS="$HADOOP_OPTS -Xloggc:{{hive_log_dir}}/hivemetastore-gc-%t.log -XX:+UseG1GC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCCause -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath={{hive_log_dir}}/hms_heapdump.hprof -Dhive.log.dir={{hive_log_dir}} -Dhive.log.file=hivemetastore.log"
 {% elif java_version == 11 %}
 {% if jvm_tuning_profile == 'azul_prime' %}
 export HIVE_JVM_TUNING_OPTS="-Xlog:gc*,gc+heap=debug,gc+phases=debug:file={{hive_log_dir}}/hivemetastore-gc-%t.log:time,level,tags:filecount=10,filesize=10M -XX:+UseTransparentHugePages -XX:CIMaxCompilerThreads=8 -XX:ProfileLogIn={{hive_log_dir}}/hivemetastore.profile -XX:ProfileLogOut={{hive_log_dir}}/hivemetastore.profile -XX:+UseZingMXBeans"
 {% else %}
 export HIVE_JVM_TUNING_OPTS="-Xlog:gc*,gc+heap=debug,gc+phases=debug:file={{hive_log_dir}}/hivemetastore-gc-%t.log:time,level,tags:filecount=10,filesize=10M -XX:+UseG1GC"
 {% endif %}
 export HADOOP_OPTS="$HADOOP_OPTS ${HIVE_JVM_TUNING_OPTS} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath={{hive_log_dir}}/hms_heapdump.hprof -Dhive.log.dir={{hive_log_dir}} -Dhive.log.file=hivemetastore.log"
 {% else %}
 # For Java 11+
 {% if jvm_tuning_profile == 'azul_prime' %}
 export HIVE_JVM_TUNING_OPTS="-Xlog:gc*,gc+heap=debug,gc+phases=debug:file={{hive_log_dir}}/hivemetastore-gc-%t.log:time,level,tags:filecount=10,filesize=10M -XX:+UseTransparentHugePages -XX:CIMaxCompilerThreads=8 -XX:ProfileLogIn={{hive_log_dir}}/hivemetastore.profile -XX:ProfileLogOut={{hive_log_dir}}/hivemetastore.profile -XX:+UseZingMXBeans"
 {% else %}
 export HIVE_JVM_TUNING_OPTS="-Xlog:gc*,gc+heap=debug,gc+phases=debug:file={{hive_log_dir}}/hivemetastore-gc-%t.log:time,level,tags:filecount=10,filesize=10M -XX:+UseG1GC"
 {% endif %}
 export HADOOP_OPTS="$HADOOP_OPTS ${HIVE_JVM_TUNING_OPTS} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath={{hive_log_dir}}/hms_heapdump.hprof -Dhive.log.dir={{hive_log_dir}} -Dhive.log.file=hivemetastore.log {{jvm_flags}}"
 {% endif %}
fi
if [ "$SERVICE" = "hiveserver2" ]; then
 export HADOOP_HEAPSIZE={{hive_heapsize}} # Setting for HiveServer2 and Client
 {% if java_version == 8 %}
 # For Java 8
 export HADOOP_OPTS="$HADOOP_OPTS -Xloggc:{{hive_log_dir}}/hiveserver2-gc-%t.log -XX:+UseG1GC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCCause -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath={{hive_log_dir}}/hs2_heapdump.hprof -Dhive.log.dir={{hive_log_dir}} -Dhive.log.file=hiveserver2.log"
 {% elif java_version == 11 %}
 {% if jvm_tuning_profile == 'azul_prime' %}
 export HIVE_JVM_TUNING_OPTS="-Xlog:gc*,gc+heap=debug,gc+phases=debug:file={{hive_log_dir}}/hiveserver2-gc-%t.log:time,level,tags:filecount=10,filesize=10M -XX:+UseTransparentHugePages -XX:CIMaxCompilerThreads=8 -XX:ProfileLogIn={{hive_log_dir}}/hiveserver2.profile -XX:ProfileLogOut={{hive_log_dir}}/hiveserver2.profile -XX:+UseZingMXBeans"
 {% else %}
 export HIVE_JVM_TUNING_OPTS="-Xlog:gc*,gc+heap=debug,gc+phases=debug:file={{hive_log_dir}}/hiveserver2-gc-%t.log:time,level,tags:filecount=10,filesize=10M -XX:+UseG1GC"
 {% endif %}
 export HADOOP_OPTS="$HADOOP_OPTS ${HIVE_JVM_TUNING_OPTS} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath={{hive_log_dir}}/hs2_heapdump.hprof -Dhive.log.dir={{hive_log_dir}} -Dhive.log.file=hiveserver2.log"
 {% else %}
 # For Java 11+
 {% if jvm_tuning_profile == 'azul_prime' %}
 export HIVE_JVM_TUNING_OPTS="-Xlog:gc*,gc+heap=debug,gc+phases=debug:file={{hive_log_dir}}/hiveserver2-gc-%t.log:time,level,tags:filecount=10,filesize=10M -XX:+UseTransparentHugePages -XX:CIMaxCompilerThreads=8 -XX:ProfileLogIn={{hive_log_dir}}/hiveserver2.profile -XX:ProfileLogOut={{hive_log_dir}}/hiveserver2.profile -XX:+UseZingMXBeans"
 {% else %}
 export HIVE_JVM_TUNING_OPTS="-Xlog:gc*,gc+heap=debug,gc+phases=debug:file={{hive_log_dir}}/hiveserver2-gc-%t.log:time,level,tags:filecount=10,filesize=10M -XX:+UseG1GC"
 {% endif %}
 export HADOOP_OPTS="$HADOOP_OPTS ${HIVE_JVM_TUNING_OPTS} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath={{hive_log_dir}}/hs2_heapdump.hprof -Dhive.log.dir={{hive_log_dir}} -Dhive.log.file=hiveserver2.log {{jvm_flags}}"
 {% endif %}
fi
{% if security_enabled %}
export KRB5_CONFIG={{krb5_conf_path}}
export HADOOP_OPTS="$HADOOP_OPTS -Dzookeeper.sasl.client.username={{zk_principal_user}} -Djava.security.krb5.conf={{krb5_conf_path}}"
{% endif %}
export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Xms${HADOOP_HEAPSIZE}m -Xmx${HADOOP_HEAPSIZE}m"
export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS{{heap_dump_opts}}"
{% if java_version|int > 11 %}
export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS {{jvm_flags}}"
{% endif %}
# Larger heap size may be required when running queries over large number of files or partitions.
# By default hive shell scripts use a heap size of 256 (MB).  Larger heap size would also be
# appropriate for hive server (hwi etc).
# Set HADOOP_HOME to point to a specific hadoop install directory
HADOOP_HOME=${HADOOP_HOME:-{{hadoop_home}}}
export HIVE_HOME=${HIVE_HOME:-{{hive_home_dir}}}
# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=${HIVE_CONF_DIR:-{{hive_config_dir}}}
# Folder containing extra libraries required for hive compilation/execution can be controlled by:
if [ "${HIVE_AUX_JARS_PATH}" != "" ]; then
 if [ -f "${HIVE_AUX_JARS_PATH}" ]; then
 export HIVE_AUX_JARS_PATH=${HIVE_AUX_JARS_PATH}
 elif [ -d "/usr/odp/current/hive-webhcat/share/hcatalog" ]; then
 export HIVE_AUX_JARS_PATH=/usr/odp/current/hive-webhcat/share/hcatalog/hive-hcatalog-core.jar
 fi
elif [ -d "/usr/odp/current/hive-webhcat/share/hcatalog" ]; then
 export HIVE_AUX_JARS_PATH=/usr/odp/current/hive-webhcat/share/hcatalog/hive-hcatalog-core.jar
fi
export METASTORE_PORT={{hive_metastore_port}}
{% if sqla_db_used or lib_dir_available %}
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:{{jdbc_libs_dir}}"
export JAVA_LIBRARY_PATH="$JAVA_LIBRARY_PATH:{{jdbc_libs_dir}}"
{% endif %}
if [ "$SERVICE" = "hiveserver2" ]; then
export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS  -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=8008"
fi
if [ "$SERVICE" = "metastore" ]; then
export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS  -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=8009"
fi

General -> hive.tez.java.opts

File location: Log into the Ambari UI → Hive → Configs → General -> hive.tez.java.opts
-server -Djava.net.preferIPv4Stack=true -XX:NewRatio=8 -XX:+UseNUMA {% if java_version|int >= 11 %}{% if jvm_tuning_profile == 'azul_prime' %}-XX:+ResizeTLAB -Xlog:gc*:stdout:time,level,tags -XX:+UseTransparentHugePages -XX:CIMaxCompilerThreads=8 -XX:+UseZingMXBeans{% else %}-XX:+UseG1GC -XX:+ResizeTLAB -Xlog:gc*,gc+heap=debug,gc+phases=debug:stdout:time,level,tags{% endif %}{% else %}-XX:+UseG1GC -XX:+ResizeTLAB -Xlog:gc*,gc+heap=debug,gc+phases=debug:stdout:time,level,tags{% endif %}{% if java_version|int > 11 %} {{jvm_flags}}{% endif %}

Advanced hive-interactive-env -> LLAP app java opts

File location: Log into the Ambari UI → Hive → Configs → Advanced hive-interactive-env -> LLAP app java opts
-XX:+AlwaysPreTouch {% if java_version|int >= 11 %}{% if jvm_tuning_profile == 'azul_prime' %}-XX:+UseTransparentHugePages -XX:CIMaxCompilerThreads=8 -XX:ProfileLogIn={{hive_log_dir}}/llap.profile -XX:ProfileLogOut={{hive_log_dir}}/llap.profile -XX:+UseZingMXBeans {% else %}-XX:+UseG1GC -XX:InitiatingHeapOccupancyPercent=70 -XX:+UnlockExperimentalVMOptions -XX:G1MaxNewSizePercent=40 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=200 {% endif %}{% else %}-XX:+UseG1GC -XX:InitiatingHeapOccupancyPercent=70 -XX:+UnlockExperimentalVMOptions -XX:G1MaxNewSizePercent=40 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=200 {% endif %}-XX:+UseNUMA{{heap_dump_opts}}{% if java_version|int > 11 %} {{jvm_flags}}{% endif %}

Advanced hive-interactive-env -> hive-interactive-env

File location: Log into the Ambari UI → Hive → Configs → Advanced hive-interactive-env -> hive-interactive-env

{% if java_version|int >= 11 %}
{% if jvm_tuning_profile == 'azul_prime' %}
export HIVE_JVM_TUNING_OPTS="-Xlog:gc*,gc+heap=debug,gc+phases=debug:file={{hive_log_dir}}/hiveserverinteractive-gc-%t.log:time,level,tags:filecount=10,filesize=10M -XX:+UseTransparentHugePages -XX:CIMaxCompilerThreads=8 -XX:ProfileLogIn={{hive_log_dir}}/hiveserverinteractive.profile -XX:ProfileLogOut={{hive_log_dir}}/hiveserverinteractive.profile -XX:+UseZingMXBeans"
{% else %}
export HIVE_JVM_TUNING_OPTS="-Xlog:gc*,gc+heap=debug,gc+phases=debug:file={{hive_log_dir}}/hiveserverinteractive-gc-%t.log:time,level,tags:filecount=10,filesize=10M -XX:+UseG1GC"
{% endif %}
export HADOOP_OPTS="$HADOOP_OPTS ${HIVE_JVM_TUNING_OPTS} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath={{hive_log_dir}}/hsi_heapdump.hprof -Dhive.log.dir={{hive_log_dir}} -Dhive.log.file=hiveserver2Interactive.log"
{% if java_version|int > 11 %}
export HADOOP_OPTS="$HADOOP_OPTS {{jvm_flags}}"
{% endif %}
{% else %}
export HADOOP_OPTS="$HADOOP_OPTS -Xloggc:{{hive_log_dir}}/hiveserverinteractive-gc-%t.log -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath={{hive_log_dir}}/hsi_heapdump.hprof -Dhive.log.dir={{hive_log_dir}} -Dhive.log.file=hiveserver2Interactive.log"
{% endif %}
# The heap size of the jvm stared by hive shell script can be controlled via:
export HADOOP_HEAPSIZE={{hive_interactive_heapsize}} # Setting for HiveServer2 and Client
{% if security_enabled %}
export KRB5_CONFIG={{krb5_conf_path}}
export HADOOP_OPTS="$HADOOP_OPTS -Dzookeeper.sasl.client.username={{zk_principal_user}} -Djava.security.krb5.conf={{krb5_conf_path}}"
{% endif %}
export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Xms${HADOOP_HEAPSIZE}m -Xmx${HADOOP_HEAPSIZE}m"
export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS{{heap_dump_opts}}"
{% if java_version|int > 11 %}
export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS {{jvm_flags}}"
{% endif %}
# Larger heap size may be required when running queries over large number of files or partitions.
# By default hive shell scripts use a heap size of 256 (MB).  Larger heap size would also be
# appropriate for hive server (hwi etc).
# Set HADOOP_HOME to point to a specific hadoop install directory
HADOOP_HOME=${HADOOP_HOME:-{{hadoop_home}}}
# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR={{hive_server_interactive_conf_dir}}
# Add additional hcatalog jars
if [ "${HIVE_AUX_JARS_PATH}" != "" ]; then
 export HIVE_AUX_JARS_PATH=${HIVE_AUX_JARS_PATH}
else
 export HIVE_AUX_JARS_PATH=/usr/odp/current/hive-server2/lib/hive-hcatalog-core.jar
fi
export METASTORE_PORT={{hive_metastore_port}}

Custom hive-site -> jvm_flags

File location: Log into the Ambari UI → Hive → Configs → Custom hive-site -> jvm_flags
--add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.math=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.regex=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/jdk.internal.reflect=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/sun.nio.cs=ALL-UNNAMED --add-opens=java.base/sun.security.provider=ALL-UNNAMED --add-opens=java.sql/java.sql=ALL-UNNAMED