本文介绍了无法从Python连接到正在运行的H2o服务器[H2O.ai]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从主节点连接到EMR核心节点上运行的H2o服务器时出错.

import h2o
h2o.connect(url="http://IP:54321")

错误跟踪

Connecting to H2O server at http://IP:54321... successful.
Traceback (most recent call last):
  File "/home/hadoop/TataCliqEMR/app/__init__.py", line 3, in <module>
    h2o.connect(ip="IP", port=54321)
  File "/usr/local/lib/python3.4/site-packages/h2o/h2o.py", line 86, in connect
    h2oconn.cluster.show_status()
  File "/usr/local/lib/python3.4/site-packages/h2o/backend/cluster.py", line 190, in show_status
    ["H2O internal security:",     self.internal_security_enabled],
  File "/usr/local/lib/python3.4/site-packages/h2o/backend/cluster.py", line 121, in internal_security_enabled
    return self._props["internal_security_enabled"]
KeyError: 'internal_security_enabled'

这里也没有答案

解决方案

其原因是H2O后端和客户端的版本不兼容(在这种情况下,客户端是 h2o Python模块) . H2O后端(集群上运行的Java进程)的版本和您在本地使用的Python h2o 模块的版本必须相同.

您的服务器(位于"http://IP:54321")似乎正在运行旧版本的H2O.由于您已经有正在尝试连接的H2O集群正在运行,因此最好的解决方案可能是安装 h2o Python模块的其他版本(而不是相反).

如果您不知道服务器运行的是哪个版本,则可以查看日志,或者尝试使用h2o.init(ip=IP),它应该返回一个正确的版本不匹配"错误,该错误将告诉您两个版本. /p>

要下载 h2o Python模块的特定版本,可以查看 Changes.md 作为发行版名称(例如"Turing"),然后转到下载"页面URL.例如,如果我想下载3.10.4.2,我将在上面链接的Changes.md上搜索"3.10.4.2",请注意发行版名称为"Ueno".有了这些信息,您就可以为该版本的下载页面构造URL,例如:

http://h2o-release.s3.amazonaws.com/h2o/rel-ueno/2/index.html

或者您也可以弄清楚.whl文件的确切位置:

pip install http://h2o-release.s3.amazonaws.com/h2o/rel-ueno/2/Python/h2o-3.10.4.2-py2.py3-none-any.whl

撰写此回复使我意识到,找到旧版本的链接并非易事,因此我添加了 JIRA 修复该问题.

Error on connecting to H2o server running on EMR core node from master node.

import h2o
h2o.connect(url="http://IP:54321")

Error Trace

Connecting to H2O server at http://IP:54321... successful.
Traceback (most recent call last):
  File "/home/hadoop/TataCliqEMR/app/__init__.py", line 3, in <module>
    h2o.connect(ip="IP", port=54321)
  File "/usr/local/lib/python3.4/site-packages/h2o/h2o.py", line 86, in connect
    h2oconn.cluster.show_status()
  File "/usr/local/lib/python3.4/site-packages/h2o/backend/cluster.py", line 190, in show_status
    ["H2O internal security:",     self.internal_security_enabled],
  File "/usr/local/lib/python3.4/site-packages/h2o/backend/cluster.py", line 121, in internal_security_enabled
    return self._props["internal_security_enabled"]
KeyError: 'internal_security_enabled'

It's also unanswered here

解决方案

The cause of this is incompatible versions of the H2O backend and client (in this case, the client is the h2o Python module). The version of the H2O backend (the Java process running on your cluster) and the Python h2o module that you are using locally must be the same.

It seems like your server (at "http://IP:54321") is running an older version of H2O. Since you already have an H2O cluster running that you're trying to connect to, probably the best solution is to install a different version of the h2o Python module (instead of the reverse).

If you don't know what version your server is running, then you could look at the logs, or you can try h2o.init(ip=IP) and it should return a proper "version mismatch" error which will tell you both versions.

To download a specific version of the h2o Python module, you can look in Changes.md for the release name (e.g. "Turing") and then go to the Download page URL. For example, if I wanted to download 3.10.4.2, I'd search for "3.10.4.2" on the Changes.md linked above, see that the release name is "Ueno". With that information, you can construct the URL for the download page for that version, e.g:

http://h2o-release.s3.amazonaws.com/h2o/rel-ueno/2/index.html

Or you can figure out the exact location of the .whl file as well:

pip install http://h2o-release.s3.amazonaws.com/h2o/rel-ueno/2/Python/h2o-3.10.4.2-py2.py3-none-any.whl

Writing this response made me realize it's not trivial to find links to older releases, so I added a JIRA to fix that.

这篇关于无法从Python连接到正在运行的H2o服务器[H2O.ai]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 00:57