Support Questions

Find answers, ask questions, and share your expertise

Ambari rest API to get host of particular components.

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

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

View solution in original post

2 REPLIES 2

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

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

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.