如何使用pyhive在python中运行presto查询?

2024-06-28 19:52:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图使用pyhive库在python中运行presto查询,但max retries错误即将出现。我在本地用jupyter笔记本电脑(笔记本)运行它。我想它不能连接到presto节点。我正在使用azurehdinsight集群并在head节点上安装了presto应用程序(使用starburst发行版)。我使用了集群用户名和密码,也尝试了头节点ssh user和password,但没有任何效果。以下是我的代码:

from pyhive import presto
conn= presto.connect(
    host='clustername-ssh.azurehdinsight.net',
    port=8085,
    username='sshuser'
    password='sshpassword',
    protocol='https'
    ).cursor()
conn.execute('SELECT * FROM hive.default.parquettest limit 1')

我得到的错误是:

ConnectionError: HTTPConnectionPool(host='sm-hdinsight01-ssh.azurehdinsight.net', port=8085): Max retries exceeded with url: /v1/statement (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 110] Connection timed out',))

但当我在head node终端运行它时:

^{pr2}$

我想我错过了一些重要的事情。请帮忙。在


Tags: hostnet节点port错误集群passwordconn