Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

I would to write a script which will check the status of Hivserver2 is running or not.

Solved Go to solution
Highlighted

I would to write a script which will check the status of Hivserver2 is running or not.

Explorer

I would to write a script which will check the status of Hivserver2 is running or not. I would like to connect beeline and show databases. if i get the output then Hiveserver 2 is running. Can any one help in writing the script for this ?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: I would to write a script which will check the status of Hivserver2 is running or not.

Rising Star

You can query the API exposed by Cloudera Manager and simplify your life. For example, you can run the following:

 

curl -u <CM_USER>:<CM_PASSWD> http://<CM_IP_ADDRESS>:7180/api/v19/clusters/<CLUSTER_NAME>/services/hive2

 

You'll get a Json answer in reply to your Query, with all the details related to the desired service's status. You can finally parse your Json answer (e.g. using "jq" or directly inside your bash script) and take the desired actions

 

HTH

View solution in original post

1 REPLY 1

Re: I would to write a script which will check the status of Hivserver2 is running or not.

Rising Star

You can query the API exposed by Cloudera Manager and simplify your life. For example, you can run the following:

 

curl -u <CM_USER>:<CM_PASSWD> http://<CM_IP_ADDRESS>:7180/api/v19/clusters/<CLUSTER_NAME>/services/hive2

 

You'll get a Json answer in reply to your Query, with all the details related to the desired service's status. You can finally parse your Json answer (e.g. using "jq" or directly inside your bash script) and take the desired actions

 

HTH

View solution in original post

Don't have an account?
Coming from Hortonworks? Activate your account here