python-ambariclient库有一个用于检索 host_components 的 api :
ambari.services(service_name).components(component_name).host_components
如何提取 IBM Analytics Engine 集群的 name_node?
我想我需要打个电话:
GET https://xxxx.bi.services.us-south.bluemix.net:9443/api/v1/clusters/AnalyticsEngine/services/HDFS/components/NAMENODE?fields=host_components
其中检索以下信息:
{
"href" : "https://xxxx.bi.services.us-south.bluemix.net:9443/api/v1/clusters/AnalyticsEngine/services/HDFS/components/NAMENODE?fields=host_components",
"ServiceComponentInfo" : {
"cluster_name" : "AnalyticsEngine",
"component_name" : "NAMENODE",
"service_name" : "HDFS"
},
"host_components" : [
{
"href" : "https://xxxx.bi.services.us-south.bluemix.net:9443/api/v1/clusters/AnalyticsEngine/hosts/xxxx.bi.services.us-south.bluemix.net/host_components/NAMENODE",
"HostRoles" : {
"cluster_name" : "AnalyticsEngine",
"component_name" : "NAMENODE",
"host_name" : "xxxx.bi.services.us-south.bluemix.net"
}
}
]
}