Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

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

avatar
Contributor

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

avatar

@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

avatar
Rising Star

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.

avatar

@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.

avatar
Contributor

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

avatar

@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"