apache-spark - 亚马逊电子病历 : Spark - SparkException java IOException: Failed to create local dir in/tmp/blockmgr*

标签 apache-spark hadoop hive amazon-emr beeline

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

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

但无法连接到它:

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

我已阅读 this question 的答案.我已经检查过所有节点上的文件夹权限和磁盘空间都没有问题。我的假设是我面临着类似的问题James Wierzba在评论中提问。但是,我没有足够的声誉在那里添加评论。此外,考虑到它特定于 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。

Metabase → 使用数据源 Spark SQL 连接 → 结果 java.sql.SQLException: org.apache.spark.SparkException: java.io.IOException: 无法在/mnt/tmp/blockmgr* 中创建本地目录

Redash → 使用数据源 Hive 连接 → 导致相同的错误。

最佳答案

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

What is my IP

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

Authorizing Inbound Traffic for Your Linux Instances

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

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

关于apache-spark - 亚马逊电子病历 : Spark - SparkException java IOException: Failed to create local dir in/tmp/blockmgr*,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56021982/

相关文章:

python - 无法在 Spark Streaming 作业中导入 kafkaProducer

scala - Cassandra 连接器 Apache Spark : local class incompatible

java - 简单示例 : HBase + Spring

hadoop - 使用Hue平台控制/过滤用户的Hive查询

sql - 处理来自非常大的数据库表的数据的架构

sql - SparkSQL 是 RDBMS 还是 NOSQL?

apache-spark - 联合分区的 RDD 是否会导致 Apache Spark 中的 shuffle?

java - 带下划线的 spark 数据集到 java 对象映射字段

eclipse - Hadoop eclipse插件停止工作

performance - Informatica BDE 摄取作业运行 10 多个小时,终止并重新运行后 3 小时内完成