Thursday, July 25, 2019

Debugging HiveServer2 Docker container Remotely using Intellij


Collect Jstack,Jmap and other JVM diagnostics for a JVM running inside the docker container

RUN A hiveserver2 in docker containr (please follow the link http://rajkrrsingh.blogspot.com/2019/07/running-hiveserver2-on-docker.html)

Get the container id or container name for a running container.


docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0749ae15ece8 hive3-image "hive --service hive…" 20 hours ago Up 20 hours 0.0.0.0:10000->10000/tcp jovial_swartz


now you can use container id or the container name to connect with container interactively

docker exec -it 0749ae15ece8 /bin/bash
[hive@0749ae15ece8 ~]$ pwd
/home/hive
[hive@0749ae15ece8 ~]$ jps
1 RunJar
810 Jps
[hive@0749ae15ece8 ~]$ ps aux | grep hiveserver
hive 1 1.7 21.0 2170608 431380 pts/0 Ssl+ 11:47 6:57 /usr/bin/java -Dproc_jar -Dproc_hiveserver2 -Dlog4j.configurationFile=hive-log4j2.properties -Djava.util.logging.config.file=/grid/apache-hive-3.1.1-bin/conf/parquet-logging.properties -Dyarn.log.dir=/grid/hadoop-3.1.1/logs -Dyarn.log.file=hadoop.log -Dyarn.home.dir=/grid/hadoop-3.1.1 -Dyarn.root.logger=INFO,console -Djava.library.path=/grid/hadoop-3.1.1/lib/native -Xmx256m -Dhadoop.log.dir=/grid/hadoop-3.1.1/logs -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=/grid/hadoop-3.1.1 -Dhadoop.id.str=hive -Dhadoop.root.logger=INFO,console -Dhadoop.policy.file=hadoop-policy.xml -Dhadoop.security.logger=INFO,NullAppender org.apache.hadoop.util.RunJar /grid/apache-hive-3.1.1-bin/lib/hive-service-3.1.1.jar org.apache.hive.service.server.HiveServer2 --hiveconf datanucleus.schema.autoCreateAll=true --hiveconf hive.metastore.schema.verification=false
hive 828 0.0 0.0 9096 876 pts/1 S+ 18:25 0:00 grep --color=auto hiveserver
[hive@0749ae15ece8 ~]$ jstack -l 1
......


jmap -histo:live 1

....