Created 01-31-2018 10:04 AM
hi all
we have 3 masters machines ( master01 master02 master03 ) and on each master machine we have the relevant component
how to verify by API that all component on the specific master machine are stop?
for example we want to verify that all component on master01 are stoped
the API will return info (stop/start) about all componets that are run on master01
Created 01-31-2018 10:37 AM
You can use the below curl call to get the info
curl -u {ambari-username}:{ambari-password} -H "X-Requested-By: ambari" -X GET http://{ambari-host}:{ambari-port}/api/v1/clusters/{clustername}/hosts/{host-name}/host_components?f... Sample response: { "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03/host_components?fields=HostRoles/state", "items": [ { "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03/host_components/ACCUMULO_CLIENT", "HostRoles": { "cluster_name": "cl1", "component_name": "ACCUMULO_CLIENT", "host_name": "master03", "state": "INSTALLED" }, "host": { "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03" } }, { "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03/host_components/APP_TIMELINE_SERVER", "HostRoles": { "cluster_name": "cl1", "component_name": "APP_TIMELINE_SERVER", "host_name": "master03", "state": "STARTED" }, "host": { "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03" } } ] }
Thanks,
Aditya
Created 01-31-2018 10:37 AM
You can use the below curl call to get the info
curl -u {ambari-username}:{ambari-password} -H "X-Requested-By: ambari" -X GET http://{ambari-host}:{ambari-port}/api/v1/clusters/{clustername}/hosts/{host-name}/host_components?f... Sample response: { "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03/host_components?fields=HostRoles/state", "items": [ { "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03/host_components/ACCUMULO_CLIENT", "HostRoles": { "cluster_name": "cl1", "component_name": "ACCUMULO_CLIENT", "host_name": "master03", "state": "INSTALLED" }, "host": { "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03" } }, { "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03/host_components/APP_TIMELINE_SERVER", "HostRoles": { "cluster_name": "cl1", "component_name": "APP_TIMELINE_SERVER", "host_name": "master03", "state": "STARTED" }, "host": { "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03" } } ] }
Thanks,
Aditya