【问题标题】:Not able to make Apache Superset connect to Presto DB (this PrestoDB is connected to Apache Pinot)无法使 Apache Superset 连接到 Presto DB(此 PrestoDB 连接到 Apache Pinot)
【发布时间】:2021-05-20 17:09:30
【问题描述】:

我是 Apache Pinot、PrestoDb 和 Superset 的新手。我已成功设置 PrestoDB 并使用以下步骤将其连接到 Apache Pinot:

    docker run \
      --network pinot-demo \
      --name=presto-coordinator \
      -p 8080:8080 \
      -d apachepinot/pinot-presto:latest

我可以查询 PrestoDB 并验证 PrestoDB 能够从 Pinot 获取记录。

$ presto/presto-cli --server localhost:8080 \
  --catalog pinot --schema default
    
  presto:default> show catalogs;
  presto:default> select * from my_table limit 10;
    col1   | col2
    --------------------
     val 1 | 1990380139 
     val 2 | 1990380130 
     val 3 | 1990380130 

现在,我使用官方 docker 镜像和步骤来启动和初始化 Apache Superset。由于 Superset 默认也在 8080 上运行,所以我使用了 -p 8088:8080。 (不知道是不是问题)

docker run --network pinot-demo --name superset -p 8088:8080 -d apache/superset:latest

docker exec -it superset superset fab create-admin \
   --username admin \
   --firstname Superset \
   --lastname Admin \
   --email admin@superset.com \
   --password admin

docker exec -it superset superset db upgrade

docker exec -it superset superset init

在这个 Superset Web 应用程序上,我想添加一个新的 PrestoDb 数据库。以下是我尝试过但 Superset 无法连接到 PrestoDB 的 SQLAlchemy URI。

1. hive://hive@localhost:8080/pinot
2. presto://localhost:8080/
3. presto://localhost:8080/pinot
4. presto://localhost:8080/pinot/default
5. hive://hive@localhost:8080/pinot/default

请帮我找出正确的 SQLAlchemy URI 以在 Apache Superset 和 PrestoDB 之间建立连接。

值得注意的是,当我分别使用 hive 和 presto 方言/驱动程序时,我会遇到以下错误。

使用时

hive://hive@localhost:8000/pinot

INFO:thrift.transport.TSocket:Could not connect to ('127.0.0.1', 8000)
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/thrift/transport/TSocket.py", line 113, in open
    handle.connect(sockaddr)
ConnectionRefusedError: [Errno 111] Connection refused
INFO:thrift.transport.TSocket:Could not connect to ('127.0.0.1', 8000)
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/thrift/transport/TSocket.py", line 113, in open
    handle.connect(sockaddr)
ConnectionRefusedError: [Errno 111] Connection refused
ERROR:thrift.transport.TSocket:Could not connect to any of [('127.0.0.1', 8000), ('127.0.0.1', 8000)]

使用时

presto://localhost:8000/pinot

INFO:pyhive.presto:SELECT 1
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): localhost:8000

【问题讨论】:

标签: hive sqlalchemy presto apache-superset superset


【解决方案1】:

当你尝试从 superset 访问 presto 时,网络连接在 superset 容器和 presto 容器之间,所以 localhost 将不起作用。

您需要获取 prestodb 容器的真实 ip,容器 ip 或主机 ip。您可以尝试以下方法吗?

presto://{continer_ip}:8080/pinot
presto://{host_id}:8080/pinot
  • 二字

【讨论】:

  • 使用容器 IP 有效!我确保超集容器也在 pinot-demo 网络中运行,并使用 $ docker inspect presto-coordinator 找到了容器 IP 地址
  • 太棒了。很高兴它有帮助!
猜你喜欢
  • 2021-06-08
  • 2020-08-31
  • 2021-10-26
  • 2017-03-25
  • 2018-06-23
  • 1970-01-01
  • 2020-10-18
  • 2016-11-24
  • 1970-01-01
相关资源
最近更新 更多