如何使用Ambari检索名称节点主机名? [英] How to retrieve the name node host name using Ambari?

查看:321
本文介绍了如何使用Ambari检索名称节点主机名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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"
      }
    }
  ]
}

解决方案

我创建了一个库来提取此信息.安装方式:

 pip install --quiet --upgrade git+https://github.com/snowch/ibm-analytics-engine-python@master
 

然后运行:

 from ibm_analytics_engine import AmbariOperations
ambari_ops = AmbariOperations(vcap_filename='./vcap.json')
ambari_ops.get_namenode_hostname()
 

The python-ambariclient library has an api for retrieving the host_components:

ambari.services(service_name).components(component_name).host_components

How can I extract the name_node for an IBM Analytics Engine cluster?

I think I need to make the call:

GET https://xxxx.bi.services.us-south.bluemix.net:9443/api/v1/clusters/AnalyticsEngine/services/HDFS/components/NAMENODE?fields=host_components

Which retrieves the following information:

{
  "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"
      }
    }
  ]
}

解决方案

I have created a library to extract this information. Install with:

pip install --quiet --upgrade git+https://github.com/snowch/ibm-analytics-engine-python@master

Then run:

from ibm_analytics_engine import AmbariOperations
ambari_ops = AmbariOperations(vcap_filename='./vcap.json')
ambari_ops.get_namenode_hostname()

这篇关于如何使用Ambari检索名称节点主机名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆