【发布时间】:2019-09-25 01:55:16
【问题描述】:
我有一个带有 Spark 的 AWS EMR 集群。我可以连接到它(火花):
- 通过 SSH 连接到主节点后从主节点
- 来自另一个 AWS EMR 集群
但无法连接到它:
我已阅读this question 的答案。我检查了所有节点上的文件夹权限和磁盘空间都很好。我的假设是我面临James Wierzba 在 cmets 中提出的类似问题。但是,我没有足够的声誉在那里添加评论。此外,考虑到它特定于 AWS EMR,这可能是一个不同的问题。
SSH 连接到主节点后连接正常。
# SSHed to master node
$ ssh -i ~/identityfile hadoop@ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com
# on master node
$ /usr/lib/spark/bin/beeline -u 'jdbc:hive2://localhost:10001/default'
# it connects fine and I can run commands, for e.g., 'show databases;'
# Beeline version 1.2.1-spark2-amzn-0 by Apache Hive
从另一个 EMR 集群的主节点也可以正常连接到此节点。
但是,无法从我的本地计算机 (macOS Mojave) Metabase 和 Redash 进行连接。
我的本地机器:
# installed hive (for beeline)
$ brew install hive
# Beeline version 3.1.1 by Apache Hive
# connect directly
# I have checked that all ports are open for my IP
$ beeline -u 'jdbc:hive2://ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com:10001/default'
# ERROR: ConnectException: Operation timed out
#
# this connection timeout probably has something to do with spark accepting only localhost connections
# I have allowed all the ports in AWS security group for my IP
# connect via port forwarding
# open a port
$ ssh -i ~/identityfile -Nf -L 10001:localhost:10001 hadoop@ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com
$ beeline -u 'jdbc:hive2://localhost:10001/default'
# Failed to connect to localhost:10001
# Required field 'client_protocol' is unset!
$ beeline -u 'jdbc:hive2://localhost:10001/;transportMode=http'
# org.apache.http.ProtocolException: The server failed to respond with a valid HTTP response
我已经在 ec2 中设置了 Metabase 和 Redash。
元数据库 → 使用数据源 Spark SQL 连接 → 结果
java.sql.SQLException: org.apache.spark.SparkException: java.io.IOException: Failed to create local dir in /mnt/tmp/blockmgr*
Redash → 使用数据源 Hive 连接 → 导致同样的错误。
【问题讨论】:
-
您检查过您的安全组吗?端口应该打开。 Amazon 上的连接超时通常是未打开的端口。
-
是的,我在安全组中打开了我的 IP 的所有流量。我已经用该信息更新了问题。
标签: apache-spark hadoop hive amazon-emr beeline