This page describes how to enable Hive query statistics, configure JMX for HiveServer2 and Metastore, and place Pulse hook JARs for Hive and Tez so that Pulse can collect query data and metrics.
View Hive Table Details in Pulse
To display Hive table details with data in Pulse:
- Enable automatic statistics gathering. In the
hive-site.xmlfile, set the following properties totrue:
hive.stats.autogatherhive.stats.column.autogatherThis allows Hive to compute table statistics automatically.
- Compute statistics manually (optional). You can also run the following Hive command to compute table statistics manually:
ANALYZE TABLE <table_name> COMPUTE STATISTICS;Configure HiveServer2 JMX
In the Ambari UI:
- Navigate to Hive > Configs >
Advanced hive-env>hive-env template. - In
hive-envtemplate``, choose and add one of the following JMX configurations based on your security requirements.
Enable JMX without Security on JMX Remote Port
To enable JMX port without any security, add the following parameters at the end of the file:
if [ "$SERVICE" = "hiveserver2" ]; thenexport 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"fiAvoid JMX Changes for Hive 1.x Using the MR Engine
Do not enable JMX for Hive 1.x when using the MapReduce (MR) execution engine. A known bug can cause query failures if JMX is enabled.
Enable Basic Authentication on JMX Remote Port (Optional)
To enable basic authentication on the JMX remote port, add the following parameters:
if [ "$SERVICE" = "hiveserver2" ]; thenexport HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.access.file=</path/to/jmxremote.access/file> -Dcom.sun.management.jmxremote.password.file=</path/to/jmxremote.password/file> -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=8008"fiEnable TLS/SSL on JMX Remote Port (Optional)
To enable TLS/SSL authentication on the JMX remote port, add the following parameters:
if [ "$SERVICE" = "hiveserver2" ]; thenexport HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.access.file=</path/to/jmxremote.access/file> -Dcom.sun.management.jmxremote.password.file=</path/to/jmxremote.password/file> -Dcom.sun.management.jmxremote.ssl=true -Dcom.sun.management.jmxremote.registry.ssl=true -Djavax.net.ssl.keyStore=</path/to/keystore.jks/file> -Djavax.net.ssl.keyStorePassword=<Keystore Password> -Djavax.net.ssl.trustStore=</path/to/truststore.jks/file> -Djavax.net.ssl.trustStorePassword=<Truststore Password> -Dcom.sun.management.jmxremote.port=8008"fiConfigure Hive Metastore JMX
In the Ambari UI:
- Navigate to Hive > Configs >
Advanced hive-env>hive-env template. - In
hive-env template, choose and add one of the following JMX configurations based on your security requirements.
Enable JMX without Security on JMX Remote Port
To enable JMX port without any security, add the following parameters at the end of the file:
if [ "$SERVICE" = "metastore" ]; thenexport 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"fiEnable JMX With Basic Authentication (Optional)
To enable basic authentication on the JMX remote port, add the following parameters:
if [ "$SERVICE" = "metastore" ]; thenexport HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.access.file=</path/to/jmxremote.access/file> -Dcom.sun.management.jmxremote.password.file=</path/to/jmxremote.password/file> -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=8008"fiEnable JMX With TLS/SSL Authentication (Optional)
To enable TLS/SSL authentication on the JMX remote port, add the following parameters:
if [ "$SERVICE" = "metastore" ]; thenexport HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.access.file=</path/to/jmxremote.access/file> -Dcom.sun.management.jmxremote.password.file=</path/to/jmxremote.password/file> -Dcom.sun.management.jmxremote.ssl=true -Dcom.sun.management.jmxremote.registry.ssl=true -Djavax.net.ssl.keyStore=</path/to/keystore.jks/file> -Djavax.net.ssl.keyStorePassword=<Keystore Password> -Djavax.net.ssl.trustStore=</path/to/truststore.jks/file> -Djavax.net.ssl.trustStorePassword=<Truststore Password> -Dcom.sun.management.jmxremote.port=8008"fiPlace Pulse hook JARs and Set Properties (Hive and Tez)
Pulse uses Hive and Tez hooks to capture query statistics.
Hook JAR Mapping
| Distro Version | Hive Version | Tez Version | Pulse Hook Jar Name |
|---|---|---|---|
| ODP | 3.1.4 | 0.10.1 | ad-hive-hook_odp 3.1.4-assembly-2.0.0.jar |
| ODP | 0.10.2.3.3.6.4-2(JAVA 17) | 3.1.3.3.3.6.4-2(JAVA 17) | ad-hive-hook_odp_ 3.1.3-assembly-2.0.0.jar (only supported for Hive and Tez running on JAVA 17) |
| ODP | 0.10.3,0.10.3 | 4.0.0,4.0.1 | ad-hive-hook_odp_ 3.3.6_java11 |
Steps to Place Hive Hook JARs
- Get the Hive hook JARs from Acceldata (see mapping above).
- Place the JARs on all edge nodes, HiveServer2, and Hive interactive nodes in:
/opt/acceldata- Ensure the hook directory is readable and executable by all users.
- Add the hook JARs to
AUX_CLASSPATH:
Update the hook JAR name in the following properties based on your installed ODP Tez and Hive versions.
- For HiveServer2, navigate to Hive > Configs >
Advanced hive-env, add the following hook jar.
For example:
export AUX_CLASSPATH=/opt/acceldata/ad-hive-hook_odp 3.1.4-assembly-2.0.0.jar- For Hive Interactive, navigate to Hive > Configs >
Advanced hive-interactive-env, add the following hook jar.
For example:
export AUX_CLASSPATH=/opt/acceldata/ad-hive-hook_odp 3.1.4-assembly-2.0.0.jarConfiguration
Set the following parameters and values for Hive and Tez:
In the Ambari UI, go to Services > Hive.
On the Hive page, click the Configs tab.
In Configs, select Custom-hive-site and set the following:
- ad.events.streaming.servers=(<Pulse IP>:19009)
- ad.cluster=(cluster name as specified in Pulse installation)
- (Optional: Add this only if the YARN Optimizer is enabled) Click Add Property to add a new property, and add ad.tez.fingerprinting:
true
Repeat the same configuration steps for Tez under Services > Tez > Configs > Custom-tez-site in the Ambari UI.
Save the configuration changes.
Restart the affected services to apply the new configuration.
Hive hook
In the Ambari UI:
- Navigate to Hive > Configs > Advanced > General.
- Ensure
io.acceldata.hive.AdHiveHookis added (comma-separated) under:
hive.exec.failure.hookshive.exec.pre.hookshive.exec.post.hooksTez hook
In the Ambari UI:
- Navigate to Tez > Configs > Advanced > General.
- Ensure the property
tez.history.logging.service.classis configured toio.acceldata.hive.AdTezEventsNatsClient.
Result
- View Hive table details in Pulse.
- HiveServer2 and Metastore expose JMX metrics.
- Pulse hooks (Hive/Tez) emit execution events to Pulse.
- Pulse hooks (Hive/Tez) send fingerprinting of applications to Pulse.