Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

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

avatar
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

avatar
Super Collaborator

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

avatar
Super Collaborator

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