Community Articles

Find and share helpful community-sourced technical articles.
Labels (1)
avatar
Expert Contributor

By default the GC logs are not enabled for Hive components. It is good to enable them to troubleshoot GC pauses on hiveserver2 instances.

---------------------------------

Hiveserver2 / Metastore:

---------------------------------

In Ambari navigate to the following path

Services -- > Hive -- > Configs -- > Advanced --> Advanced hive-env --> hive-env template

Add the following lines at the beginning,

if [[ "$SERVICE" == "hiveserver2" || "$SERVICE" == "metastore" ]]; then

HIVE_SERVERS_GC_LOG_OPTS="-Xloggc:{{hive_log_dir}}/gc.log-$SERVICE-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps"

export HADOOP_OPTS="$HADOOP_OPTS $HIVE_SERVERS_GC_LOG_OPTS"

fi

---------------------------------

Webhact :

---------------------------------

In Ambari navigate to the following path

Services -- > Hive -- > Configs -- > Advanced --> Advanced webhcat-env --> webhcat-env template

Add the following lines at the bottom,

WEBHACAT_GC_LOG_OPTS="-Xloggc:{{templeton_log_dir}}/gc.log-webhcat-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps"

export HADOOP_OPTS="$HADOOP_OPTS $WEBHACAT_GC_LOG_OPTS"

Save the changes in ambari and restart the hive services , it will enable the GC logs writing at the restart.

Thanks for the following articles. I changed the GC file name similar to namenode GC logs and kept all the GC variables in single parameter for simplicity.

https://community.hortonworks.com/content/supportkb/49404/how-to-setup-gc-log-for-hiveserver2.html

http://stackoverflow.com/questions/39888681/how-to-enable-gc-logging-for-apache-hiveserver2-metastor...

4,936 Views