Created 07-28-2017 10:18 AM
How to get host address for particular service (like hbase, hive, ..etc) installed ?
Created 07-28-2017 10:27 AM
this is sample curl request to get information of zookeeper service, hope this will serve your purpose
curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://<AMBARI_HOST>:8080/api/v1/clusters/<CLUSTERNAME>/services/ZOOKEEPER
Created 07-28-2017 10:34 AM
Services are not installed on hosts, Instead the Components are installed on individual hosts.
For example HDFS is service name, But actually it's components like "NameNode", "DataNode", "JournalNode" ...etc are installed on individual hosts.
You can get the list of components installed on a particular host using the following API:
To get the list of hosts of your cluster.
http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME/hosts/
To get the list of components installed on $HOSTNAME
http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME/hosts/$HOSTNAME/host_components
Another approach will be to use the following call:
Syntax:
curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME/services/HDFS/components/NAMENODE?fields=host...
Example:
curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/services/HDFS/components/NAMENODE?fiel...
.
Example Output: (Find All the Host that have "NameNode" Installed)
curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/services/HDFS/components/NAMENODE?fiel... { "href" : "http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/services/HDFS/components/NAMENODE?fields=host_components/HostRoles/host_name", "ServiceComponentInfo" : { "cluster_name" : "plain_ambari", "component_name" : "NAMENODE", "service_name" : "HDFS" }, "host_components" : [ { "href" : "http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/hosts/amb25101.example.com/host_components/NAMENODE", "HostRoles" : { "cluster_name" : "plain_ambari", "component_name" : "NAMENODE", "host_name" : "amb25101.example.com" } }, { "href" : "http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/hosts/amb25102.example.com/host_components/NAMENODE", "HostRoles" : { "cluster_name" : "plain_ambari", "component_name" : "NAMENODE", "host_name" : "amb25102.example.com" } } ] }
.
Similarly the following API can be used to find DATANODE is installed on what all nodes:
curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://amb25101.example.com:8080/api/v1/clusters/plain_ambari/services/HDFS/components/DATANODE?fiel...
.