• 一、spark错误


    1、

    17/07/17 15:34:55 ERROR yarn.ApplicationMaster: User class threw exception: java.lang.UnsupportedOperationException: empty collection
    java.lang.UnsupportedOperationException: empty collection
    	at org.apache.spark.rdd.RDD$$anonfun$reduce$1$$anonfun$apply$40.apply(RDD.scala:1027)
    	at org.apache.spark.rdd.RDD$$anonfun$reduce$1$$anonfun$apply$40.apply(RDD.scala:1027)
    	at scala.Option.getOrElse(Option.scala:120)
    	at org.apache.spark.rdd.RDD$$anonfun$reduce$1.apply(RDD.scala:1027)
    	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150)
    	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:111)
    	at org.apache.spark.rdd.RDD.withScope(RDD.scala:316)
    	at org.apache.spark.rdd.RDD.reduce(RDD.scala:1007)
    	at sparkoffline.DayCount$.dayCount(DayCount.scala:44)
    	at sparkoffline.Main$.main(Main.scala:35)
    	at sparkoffline.Main.main(Main.scala)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at org.apache.spark.deploy.yarn.ApplicationMaster$$anon$2.run(ApplicationMaster.scala:558)
    17/07/17 15:34:55 INFO yarn.ApplicationMaster: Final app status: FAILED, exitCode: 15, (reason: User class threw exception: java.lang.UnsupportedOperationException: empty collection)
    17/07/17 15:34:55 INFO spark.SparkContext: Invoking stop() from shutdown hook
    

      spark 从hbase过滤出数据形成RDD,然后再做计算,这个错误大概意思是  从hbase过滤出来的数据为空,也就是一个空的RDD

    2、

    org.apache.spark.shuffle.MetadataFetchFailedException: Missing an output location for shuffle 12
    	at org.apache.spark.MapOutputTracker$$anonfun$org$apache$spark$MapOutputTracker$$convertMapStatuses$2.apply(MapOutputTracker.scala:548)
    	at org.apache.spark.MapOutputTracker$$anonfun$org$apache$spark$MapOutputTracker$$convertMapStatuses$2.apply(MapOutputTracker.scala:544)
    	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:544)
    	at org.apache.spark.MapOutputTracker.getMapSizesByExecutorId(MapOutputTracker.scala:155)
    	at org.apache.spark.shuffle.BlockStoreShuffleReader.read(BlockStoreShuffleReader.scala:47)
    	at org.apache.spark.rdd.ShuffledRDD.compute(ShuffledRDD.scala:98)
    	at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:306)
    	at org.apache.spark.rdd.RDD.iterator(RDD.scala:270)
    	at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
    	at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:306)
    	at org.apache.spark.rdd.RDD.iterator(RDD.scala:270)
    	at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:73)
    	at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:41)
    	at org.apache.spark.scheduler.Task.run(Task.scala:89)
    	at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:227)
    	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) 

    org.apache.spark.shuffle.MetadataFetchFailedException: Missing an output location for shuffle
    解决方案:这种问题一般发生在有大量shuffle操作的时候,task不断的failed,然后又重执行,一直循环下去,直到application失败。一般遇到这种问题提高executor内存即可,同时增加每个executor的cpu,这样不会减少task并行度。

                     或者改代码,替代shuffle 算子(例如reducebykey 替代groupbykey)

  • 相关阅读:
    初识DJango框架
    web框架基础
    前端——JavaScript
    前端——css(下)
    前端——css(上)
    前端——html
    spring注解
    spring boot 详解(1)spring boot +mybatis+mysql+jsp
    spring 事务控制
    maven pom文件管理
  • 原文地址:https://www.cnblogs.com/liuwei6/p/7228233.html
Copyright © 2020-2023  润新知