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.

How to check if specific set of component is installed on HDP (without ambari UI) ?

Solved Go to solution

How to check if specific set of component is installed on HDP (without ambari UI) ?

Explorer

We are working on application which contains Spark, hdfs, and kafka. We want to deploy this application on existing HDP cluster. So what would be the best approach/way to deploy this application on HDP in less time. What I want to do is to create some script that will co-ordinate with ambari and findout which component is already installed on existing HDP. For. Ex if some HDP cluster doesnot contain spark then it will automatically download (from hortonwork repo) and configure spark on that HDP cluster otherwise simply load all tasks/jobs. Can I use zookeeper to detect which service is installed and detect its state (running/stopped/maintainence) ?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to check if specific set of component is installed on HDP (without ambari UI) ?

@Vivek Singh

As Phil suggested, REST is a good way to do this. Check all services installed;

curl -u admin:admin -H "X-Requested-By: ambari"-X GET http://{your-ambari-server}:8080/api/v1/clusters/{clustername}/services/

Then check the status of a service, for example Spark 2;

curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://{your-ambari-server}:8080/api/v1/clusters/{clustername}/services/SPARK2

Look for the 'state' from this output, should be showing either 'installed' (stopped) or 'started'.

You can substitute services for components to check on components.

View solution in original post

4 REPLIES 4
Highlighted

Re: How to check if specific set of component is installed on HDP (without ambari UI) ?

Cloudera Employee

Have you considered using the Ambari REST API, or are you concerned with clusters which are not managed by Ambari?

You could use curl to invoke it from your scripts.

Highlighted

Re: How to check if specific set of component is installed on HDP (without ambari UI) ?

@Vivek Singh

As Phil suggested, REST is a good way to do this. Check all services installed;

curl -u admin:admin -H "X-Requested-By: ambari"-X GET http://{your-ambari-server}:8080/api/v1/clusters/{clustername}/services/

Then check the status of a service, for example Spark 2;

curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://{your-ambari-server}:8080/api/v1/clusters/{clustername}/services/SPARK2

Look for the 'state' from this output, should be showing either 'installed' (stopped) or 'started'.

You can substitute services for components to check on components.

View solution in original post

Highlighted

Re: How to check if specific set of component is installed on HDP (without ambari UI) ?

Explorer

Is there any way to do the same task using zookeeper ?

Highlighted

Re: How to check if specific set of component is installed on HDP (without ambari UI) ?

@Vivek Singh

Unfortunately that information isn't in zookeeper, so we can't get it from there unless you write the information to zookeeper yourself (the solution might get overly complicated now). If you really must avoid REST you could try to query the ambari database to list the installed services for example like so;

psql ambari -U ambari -W -p 5432 -c "select * from clusterservices"
Don't have an account?
Coming from Hortonworks? Activate your account here