-1

如何通过api/web-services识别远程Hadoop集群的版本?即集群是1.x类型还是2.x类型?是否有任何可用的 API/Web 服务?

我研究过webhdfs?hadoop 文件系统但无法识别的方式来做到这一点?

4

3 回答 3

0

一种方法是通过识别异常(或多或少的命中和试验方法):

如果在客户端使用 1.x API 并连接到 2.x Hadoop 集群或反之,则通过:

    final String uri = "hdfs://remoteHostName:9000/user/myusername";
    final FileSystem fs = FileSystem.get (URI.create (uri), conf);

然后我们得到以下异常

Exception in thread "main" org.apache.hadoop.ipc.RemoteException: Server IPC version 9 cannot communicate with client version 4

上述异常表明客户端 API 和远程 Hadoop 集群不兼容,但无法获得绝对的方法来识别远程 Hadoop 集群的版本。

于 2014-04-17T10:08:45.093 回答
0

如果您安装了Ambari(许多集群,尤其是基于 HDP 的集群),您可以通过对'http://your.ambari.server/api/v1/clusters'. 生成的 JSON 将包含如下内容:

{ "href" : "http://your.ambari.server/api/v1/clusters",
   "items" : [
      {  "href" : "http://your.ambari.server/api/v1/clusters/c1",
         "Clusters" : { "cluster_name" : "c1",
                        "version" : "HDP-1.2.0"  }  }
   ]
}

完整的 API 参考可以在以下位置找到: https ://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/index.md

这个电话的细节在: https ://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/clusters.md

Cloudera 似乎有一些至少相似的东西,虽然我不知道它是否得到 Ambari 的支持:http: //cloudera.github.io/cm_api/apidocs/v1/path__clusters.html

于 2014-04-17T12:30:36.123 回答
0

你是否通过 ssh 的 linux 命令。你有那个集群的用户名和密码吗?然后在您获得 hadoop 版本后执行以下命令。

ssh 用户名@cluseterip hadoop 版本

然后它会要求远程机器的密码给出密码它会给出版本。

示例:: Hadoop 1.1.2

于 2014-04-17T14:29:56.667 回答