【问题标题】:AWS EMR: Spark - SparkException java IOException: Failed to create local dir in /tmp/blockmgr*AWS EMR:Spark - SparkException java IOException:无法在 /tmp/blockmgr* 中创建本地目录
【发布时间】:2019-09-25 01:55:16
【问题描述】:

我有一个带有 Spark 的 AWS EMR 集群。我可以连接到它(火花):

  • 通过 SSH 连接到主节点后从主节点
  • 来自另一个 AWS EMR 集群

但无法连接到它:

  • 来自我的本地计算机 (macOS Mojave)
  • 来自非 emr 机器,例如 MetabaseRedash

我已阅读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) MetabaseRedash 进行连接。

我的本​​地机器:

# 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


【解决方案1】:

您需要更新附加到 EMR 的 Master 节点的安全组的入站规则。您需要添加网络提供商的公共 IP 地址。您可以在以下网站上找到您的公共 IP 地址:

What is my IP

有关如何使用您的 IP 地址更新入站规则的更多详细信息,请参阅以下 AWS 文档:

Authorizing Inbound Traffic for Your Linux Instances

如果您在受限网络环境中工作,您还应该检查自己网络的出站规则。

因此,请确保您在 EMR 的主节点安全组中对您想要访问的所有端口具有出站访问权限和入站访问权限。

【讨论】:

    猜你喜欢
    • 2017-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-22
    • 1970-01-01
    • 2020-10-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多