Support Questions

Find answers, ask questions, and share your expertise

How to get list of active sessions in Hive? Or how to check whether a session is active or not by sessionId in Hive?

avatar
Explorer

Hello everyone. So the problem is next. I have Apache Hive 2.3.6. on my cluster. I start multiple sessions simultaneously and independently from each other. And then temporary .pipeout files with directories are created and if certain session end up with an error this empty files keep accumulating because they are not deleted if the session end up not right. The similar issue was here, but it was not solved - https://issues.apache.org/jira/browse/HIVE-6091.
So the question is how can I find the list of active sessions on my cluster or how can I check whether a session is active or not by sessionId in Hive? I need this information because I want to delete those .pipeout files and in order to do that I need to know which file are still in use (belongs to active session) and which are not! Thanks!

4 REPLIES 4

avatar
Master Collaborator

Hi,

 

I think you can check the HS2 active sessions by navigating to HS2 WEB UI, here is the screenshot for your reference.Screen Shot 2021-09-29 at 6.54.57 AM.png

 

Regards,

Chethan YM

avatar
Explorer

Thanks for the answer, but the result is negative, I don't know why, but the UI simply do not show appropriate information. I tested it, I started 2 different sessions of Hive simultaneously and initially yes - the UI shows new running sessions of Hive properly, but then when I reproduce the error of session with "kill - 9" command the UI do not updates and keep showing that there are still 2 active sessions (truly only one left - first screen). I waited a couple minutes updating the page and then UI showed that there are no active sessions, that both are finished successfully (truly - one session is killed and one is still active and proceed queries - second screen).

 

 

 

avatar
Expert Contributor

Hi @Kicker 

 

Question: How can I find the list of active sessions on my cluster or how can I check whether a session is active or not by sessionId in Hive?

 

Answer: Could you please take a look at the below link where we discussed a similar question.
https://community.cloudera.com/t5/Support-Questions/How-many-users-connected-to-HiveServer2/m-p/3223...

 

You may have to log in to hiveserver2 and run the below command to see the active number of connections to hiveserver2.
netstat -ntpla | grep 10000 | grep -i ESTABLISHED ### Instead of 10000 you have to mention your HS2 Port(if you use http more the port number will be 10001)
netstat -ntpla | grep 10000 ### This gives you the detail of Established, Close_wait, and other processes as well.


If you want to check the Active sessions you can find the details in Hiveserver2 Web UI
Ambari > Hive > QuickLinks > Hiveserver2 WebUI

 

If you are happy with the reply, mark it Accept as Solution

avatar
Explorer

Thanks for the answer, but it is not the solution. See my reply above.