Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

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 Member

fix: `componentname` should be `component_name`