确定远程hadoop集群的版本

ffx8fchx  于 2021-06-03  发布在  Hadoop
关注(0)|答案(3)|浏览(330)

如何通过api/web服务识别远程hadoop集群的版本?i、 e.集群是1.x类型还是2.x类型?是否有任何api/web服务可用于相同的应用程序?
我研究过webhdfs吗?hadoop文件系统,但不能确定的方式来做吗?

332nm8kg

332nm8kg1#

如果您已经安装了ambari(许多集群都会安装,尤其是那些基于hdp的集群),那么您可以通过执行get to来获取集群版本信息 '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

m3eecexj

m3eecexj2#

您是否检查过ssh的linux命令。你有那个集群的用户名和密码吗。然后在得到hadoop版本后执行下面的命令。
宋承宪username@cluseterip hadoop版本
然后它会询问远程机器的密码给密码它会给版本。
示例::hadoop 1.1.2

3bygqnnd

3bygqnnd3#

一种方法是通过识别异常(或多或少是一种命中试验方法):
如果在客户机中使用1.x api并连接到2.x hadoop群集或vicecersa,通过:

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集群版本的绝对方法。

相关问题