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.

Ambari rest API to get host of particular components.

Solved Go to solution

Ambari rest API to get host of particular components.

New Contributor

Here i just want to get my resource manager hostip and its port.

example : -: http://IP:8088, http://IP:50070, http://IP:19888.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Ambari rest API to get host of particular components.

@bob bza

Let's start with: https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/index.md

Get a list of services:

GET /clusters/:name/services

For any of the services listed, including ResourceManager, view service information:

GET /clusters/:clusterName/services/:serviceName

Of course, prepend the GET statements with:

curl -u admin:admin -H "X-Requested-By: ambari"-X

Another useful reference: https://cwiki.apache.org/confluence/display/AMBARI/Using+APIs+to+delete+a+service+or+all+host+compon...

Please vote/accept answer, if helpful.

2 REPLIES 2

Re: Ambari rest API to get host of particular components.

@bob bza

Let's start with: https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/index.md

Get a list of services:

GET /clusters/:name/services

For any of the services listed, including ResourceManager, view service information:

GET /clusters/:clusterName/services/:serviceName

Of course, prepend the GET statements with:

curl -u admin:admin -H "X-Requested-By: ambari"-X

Another useful reference: https://cwiki.apache.org/confluence/display/AMBARI/Using+APIs+to+delete+a+service+or+all+host+compon...

Please vote/accept answer, if helpful.

Re: Ambari rest API to get host of particular components.

Cloudera Employee

@bob bza

You may also find the information you see in this article: Using Ambari to Automate Knox Topology Definitions.

Specifically, while the following API will get you all the host component details, including the host(s),

api/v1/clusters/clustername/services/YARN/components/RESOURCEMANAGER

it will not get you the appropriate ports.

For that, you need to interrogate the active YARN service configuration:

api/v1/clusters/clustername/configurations/service_config_versions?service_name=YARN

And look for the yarn-site configuration type, and the following properties therein:

  • yarn.http.policy
    This will tell you if http is sufficient, or if you need to use https
  • yarn.resourcemanager.address
    The value of this property is the HOST:PORT address you originally requested.

I hope that helps...