Woo*_*per 37 hadoop-yarn apache-spark
当我使用1 GB数据集运行解析代码时,它完成没有任何错误.但是,当我一次尝试25 GB的数据时,我会遇到错误.我试图了解如何避免失败.很高兴听到任何建议或想法.
不同的错误,
org.apache.spark.shuffle.MetadataFetchFailedException: Missing an output location for shuffle 0
org.apache.spark.shuffle.FetchFailedException: Failed to connect to ip-xxxxxxxx
org.apache.spark.shuffle.FetchFailedException: Error in opening FileSegmentManagedBuffer{file=/mnt/yarn/nm/usercache/xxxx/appcache/application_1450751731124_8446/blockmgr-8a7b17b8-f4c3-45e7-aea8-8b0a7481be55/08/shuffle_0_224_0.data, offset=12329181, length=2104094}
Run Code Online (Sandbox Code Playgroud)
群集细节:
纱线:8个节点
总核心数:64
内存:500 GB
火花版本:1.5
Spark提交声明:
spark-submit --master yarn-cluster \
--conf spark.dynamicAllocation.enabled=true \
--conf spark.shuffle.service.enabled=true \
--executor-memory 4g \
--driver-memory 16g \
--num-executors 50 \
--deploy-mode cluster \
--executor-cores 1 \
--class my.parser \
myparser.jar \
-input xxx \
-output xxxx \
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪之一:
at org.apache.spark.MapOutputTracker$$anonfun$org$apache$spark$MapOutputTracker$$convertMapStatuses$2.apply(MapOutputTracker.scala:460)
at org.apache.spark.MapOutputTracker$$anonfun$org$apache$spark$MapOutputTracker$$convertMapStatuses$2.apply(MapOutputTracker.scala:456)
at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:108)
at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
at org.apache.spark.MapOutputTracker$.org$apache$spark$MapOutputTracker$$convertMapStatuses(MapOutputTracker.scala:456)
at org.apache.spark.MapOutputTracker.getMapSizesByExecutorId(MapOutputTracker.scala:183)
at org.apache.spark.shuffle.hash.HashShuffleReader.read(HashShuffleReader.scala:47)
at org.apache.spark.rdd.ShuffledRDD.compute(ShuffledRDD.scala:90)
at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:297)
at org.apache.spark.rdd.RDD.iterator(RDD.scala:264)
at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:297)
at org.apache.spark.rdd.RDD.iterator(RDD.scala:264)
at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:66)
at org.apache.spark.scheduler.Task.run(Task.scala:88)
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:214)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Run Code Online (Sandbox Code Playgroud)
Gle*_*olt 77
此错误几乎可以保证是由执行程序中的内存问题引起的.我可以想出几种方法来解决这些类型的问题.
1)您可以尝试使用更多分区(repartition在您的上面执行dataframe).当一个或多个分区包含的数据多于内存中的数据时,通常会出现内存问题.
2)我注意到你没有明确设置spark.yarn.executor.memoryOverhead,所以它默认为max(386, 0.10* executorMemory)你的情况下400MB.这对我来说听起来很低.我会尝试将其增加到1GB(请注意,如果将memoryOverhead增加到1GB,则需要降低--executor-memory到3GB)
3)查看故障节点上的日志文件.您想要查找文本"Killing container".如果您看到文本"超出物理内存限制",增加memoryOverhead将 - 根据我的经验 - 解决问题.
Ale*_*mes 11
除了上面描述的内存和网络配置问题之外,值得注意的是,对于大型表(例如,此处有几个TB),由于超时检索shuffle分区,可能会发生org.apache.spark.shuffle.FetchFailedException.要解决此问题,您可以设置以下内容:
SET spark.reducer.maxReqsInFlight=1; -- Only pull one file at a time to use full network bandwidth.
SET spark.shuffle.io.retryWait=60s; -- Increase the time to wait while retrieving shuffle partitions before retrying. Longer times are necessary for larger files.
SET spark.shuffle.io.maxRetries=10;
Run Code Online (Sandbox Code Playgroud)
好吧,这是一个老帖子了,Stackoverflow 上有很多答案,但我因为这个错误浪费了几天时间,我认为分享这个故事可能会有所帮助。
实际上有几种方法可以实现这一点。正如格伦尼(Glennie)的精彩回答所提到的,这很可能是内存问题,因此请确保您有足够的内存来处理所有内容。有容器内存、AM 内存、映射内存、化简内存等配置需要注意。阅读本文对于找到正确的配置有很大帮助。您应该自己选择数字,但这里有我设置的一些属性。
纱线站点.xml
<property>
<name>yarn.nodemanager.resource.memory-mb</name>
<value>32768</value>
</property>
<property>
<name>yarn.app.mapreduce.am.resource.mb</name>
<value>4096</value>
</property>
<property>
<name>yarn.scheduler.minimum-allocation-mb</name>
<value>4096</value>
</property>
Run Code Online (Sandbox Code Playgroud)
mapred-site.xml
<property>
<name>mapreduce.map.memory.mb</name>
<value>4096</value>
</property>
<property>
<name>mapreduce.reduce.memory.mb</name>
<value>4096</value>
</property>
Run Code Online (Sandbox Code Playgroud)
这些可以修复您可能遇到的一些其他错误,例如 PySpark shell 在启动时崩溃。但就我而言,尽管一些错误消失了(例如 MetadataFetchFailed 错误),但问题仍然存在。确切的错误是:
org.apache.spark.shuffle.FetchFailedException:无法连接到 DB-ETA-C/xxxx:34085
在尝试了从 Spark 超时到 YARN shuffle 服务的所有可能的 YARN 和 Spark 属性后,我最终意识到,在错误日志中,失败的容器正在寻找x.x.x.x,运行时的本地(内部)IPnetstat -tulpn | grep <PORT NUM>返回 yyyy:34085,其中 yyyy是外部IP地址。这根本不是内存问题,只是网络配置问题。
Spark 服务仅绑定到外部接口,因为主机名与 中的外部 IP 关联/etc/hosts。更新/etc/hosts文件后问题得到解决。
底线:该错误显然表明某个容器无法到达另一个容器。这通常是由于内存问题导致容器失败,但也可能是网络问题,因此也要注意这些问题,特别是当您的节点上有多个接口时。
| 归档时间: |
|
| 查看次数: |
31778 次 |
| 最近记录: |