Support Questions

Find answers, ask questions, and share your expertise

Ambari REST API + how to capture the active namenode IP from API

avatar

hi all

 

we have HDP version - 2.6.4 

 

with active and standby namenode

 

is it possible to capture the active namenode IP by REST API?

 

 

we try by the following API , but API not return any output 

 

curl -sH "X-Requested-By: ambari" -u admin:admin -H "X-Requested-By: ambari" -X GET http://master:8080/api/v1/clusters//services/HDFS

 

Capture.PNG

 

Michael-Bronson
1 ACCEPTED SOLUTION

avatar
Master Collaborator

@mike_bronson7  Use the following API to find out the node & state of the active/standby

 

 

# curl -u <User name>:<Password> -H 'X-Requested-By: ambari' -X GET 'http://test1:8080/api/v1/clusters/c186/host_components?HostRoles/componentname=NAMENODE&metrics/dfs/FSNamesystem/HAState=active'

# curl -u <User name>:<Password> -H 'X-Requested-By: ambari' -X GET 'http://test1:8080/api/v1/clusters/c186/host_components?HostRoles/componentname=NAMENODE&metrics/dfs/FSNamesystem/HAState=standby”

 

View solution in original post

3 REPLIES 3

avatar

You are hitting with wrong values.

 

Find below example:

curl -u admin:password "http://{hostname}:8080/api/v1/clusters/{cluster _name}/host_components?HostRoles/"

avatar
Master Collaborator

@mike_bronson7  Use the following API to find out the node & state of the active/standby

 

 

# curl -u <User name>:<Password> -H 'X-Requested-By: ambari' -X GET 'http://test1:8080/api/v1/clusters/c186/host_components?HostRoles/componentname=NAMENODE&metrics/dfs/FSNamesystem/HAState=active'

# curl -u <User name>:<Password> -H 'X-Requested-By: ambari' -X GET 'http://test1:8080/api/v1/clusters/c186/host_components?HostRoles/componentname=NAMENODE&metrics/dfs/FSNamesystem/HAState=standby”

 

avatar
New Contributor

fix: `componentname` should be `component_name`