• Spark遇到的报错和坑


    1. Java版本不一致,导致启动报错。

    # 解决方法:
    在启动脚本最前边添加系统参数,指定Java版本
    export JAVA_HOME=/usr/java/jdk1.8.0_181-amd64/jre

    2. Spark1和Spark2并存,启动时报错。

    # 在SPARK_HOME中指定启动的spark版本
    export SPARK_HOME=/data01/opt/cloudera/parcels/SPARK2-2.3.0.cloudera3-1.cdh5.13.3.p0.458809/lib/spark2

    3.缺少Hadoop依赖包

    Error: A JNI error has occurred, please check your installation and try again
    Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/Logger
            at java.lang.Class.getDeclaredMethods0(Native Method)
            at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
            at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
            at java.lang.Class.getMethod0(Class.java:3018)
            at java.lang.Class.getMethod(Class.java:1784)
            at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
            at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
    Caused by: java.lang.ClassNotFoundException: org.slf4j.Logger
            at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    解决方法:
    #添加Hadoop的classpath到SPARK_DIST_CLASSPAHT中
    export SPARK_DIST_CLASSPATH=$(hadoop classpath)

    4. 报错信息:java.lang.Error: java.lang.InterruptedException: sleep interrupted

    Exception in thread "receiver-supervisor-future-0" java.lang.Error: java.lang.InterruptedException: sleep interrupted
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1155)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.InterruptedException: sleep interrupted
        at java.lang.Thread.sleep(Native Method)
        at org.apache.spark.streaming.receiver.ReceiverSupervisor$$anonfun$restartReceiver$1.apply$mcV$sp(ReceiverSupervisor.scala:196)
        at org.apache.spark.streaming.receiver.ReceiverSupervisor$$anonfun$restartReceiver$1.apply(ReceiverSupervisor.scala:189)
        at org.apache.spark.streaming.receiver.ReceiverSupervisor$$anonfun$restartReceiver$1.apply(ReceiverSupervisor.scala:189)
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        ... 2 more
    解决方法:
        将 ssc.awaitTerminationOrTimeout(1000)
        改成ssc.awaitTermination() 即可

    5. 报错5

    FAILED: Execution Error, return code 3 from org.apache.hadoop.hive.ql.exec.mr.MapredLocalTask
    解决方法:
        set hive.mapjoin.localtask.max.memory.usage=0.99;
        set hive.auto.convert.join=false;
    
    Ref: https://blog.csdn.net/qq_21383435/article/details/78593267
  • 相关阅读:
    Spring Boot开发Web应用
    使用阿里云Docker镜像加速
    六种微服务架构的设计模式
    HashMap按键排序和按值排序
    Docker搭建本地私有仓库
    Ubuntu 14.04主机上部署k8s集群
    Ubuntu 16.04下搭建kubernetes集群环境
    Docker中images中none的镜像删除
    docker 下 alpine 镜像设置时区的有效办法
    offsetLeft和style.left的区别
  • 原文地址:https://www.cnblogs.com/chenzechao/p/10204263.html
Copyright © 2020-2023  润新知