Created 08-22-2017 06:10 PM
how to know by API command all machines in ambari cluster ,
example - master01,master02,master03,worker01,worker02,worker03,kafka01,kafka02 etc
Created 08-22-2017 06:52 PM
This Rest call will get you all host names of nodes in the cluster
http://your.ambari.server/api/v1/clusters/yourClusterName/hosts
See these links on the Ambari API
Created 08-22-2017 06:52 PM
This Rest call will get you all host names of nodes in the cluster
http://your.ambari.server/api/v1/clusters/yourClusterName/hosts
See these links on the Ambari API
Created 08-22-2017 06:53 PM
You can get the JSON response.
https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/hosts.md
http://ambari-server:8080/clusters/:clusterName/hosts
To extract the hostnames easier, you could try JSONPath
$.items[*].Hosts.host_name
Or Python with Requests library
r = requests.get('...') hosts = ','.join(x['Hosts']['host_name'] for x in r.json()['items'])