Spark 报错解决--Error initializing SparkContext

在提交spark作业的时候,spark出现报错

./spark-shell
19/05/14 05:37:40 WARN util.NativeCodeLoader: Unable to load native-hadoop
library for your platform... using builtin-java classes where applicable
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).

19/05/14 05:37:49 ERROR spark.SparkContext: Error initializing SparkContext.
org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.ipc.StandbyException):
Operation category READ is not supported in state standby. Visit https://s.apache.org/sbnn-error

    at org.apache.hadoop.hdfs.server.namenode.ha.StandbyState.checkOperation(StandbyState.java:88)
    at org.apache.hadoop.hdfs.server.namenode.NameNode$NameNodeHAContext.checkOperation(NameNode.java:1826)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkOperation(FSNamesystem.java:1404)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getFileInfo(FSNamesystem.java:4208)
    at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.getFileInfo(NameNodeRpcServer.java:895)
    at org.apache.hadoop.hdfs.server.namenode.AuthorizationProviderProxyClientProtocol.getFileInfo(AuthorizationProviderProxyClientProtocol.java:527)
    at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.getFileInfo(ClientNamenodeProtocolServerSideTranslatorPB.java:824)
    at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
    at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:617)
    at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1073)
    at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2086)
    at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2082)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:422)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1693)
    at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2080)

原因分析

今天我将spark的history-server打开了,测试的时候用的好好的,但是一会发现启动不了spark作业提交不了。
通过分析日志并查看HDFS的Web界面,发现应该是我的spark连接不到HDFS的ActiveNN,而spark启动就需要连接HDFS的服务只有写入job日志这一项,所以我查看了指定sparkJob日志写入路径的spark-defaults.conf文件,果然路径指定的是standByNN

spark.eventLog.dir              hdfs://hadoop002:8020/g6_direcory


所以spark不能通过连接standByNN将日志写入HDFS

解决

将spark-defaults.conf和spark-env.sh 里面日志目录文件路径从单一NN改为命名空间的路径就好
我的命名空间是

        <property>
                <name>fs.defaultFS</name>
                <value>hdfs://ruozeclusterg6</value>
        </property>

修改spark-defaults.conf

spark.eventLog.enabled           true
spark.eventLog.dir              hdfs://ruozeclusterg6:8020/g6_direcory

修改spark-env.sh

SPARK_HISTORY_OPTS="-Dspark.history.fs.logDirectory=hdfs://ruozeclusterg6:8020/g6_direcory"

测试

[[email protected] spark]$ spark-shell
19/05/14 06:00:04 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
Spark context Web UI available at http://hadoop002:4040
Spark context available as ‘sc‘ (master = local[*], app id = local-1557828013138).
Spark session available as ‘spark‘.
Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  ‘_/
   /___/ .__/\_,_/_/ /_/\_\   version 2.4.2
      /_/

Using Scala version 2.11.12 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_131)
Type in expressions to have them evaluated.
Type :help for more information.

scala>

解决!

原文地址:https://blog.51cto.com/14309075/2394578

时间: 2024-10-26 04:05:23

Spark 报错解决--Error initializing SparkContext的相关文章

spark-submit提交任务时报错,Error initializing SparkContext

16/03/04 00:21:09 WARN SparkContext: Using SPARK_MEM to set amount of memory to use per executor process is deprecated, please use spark.executor.memory instead. 16/03/04 00:21:09 ERROR SparkContext: Error initializing SparkContext. org.apache.spark.

报错解决 error: &quot;net.bridge.bridge-nf-call-ip6tables&quot; is an unknown key

安装Oracle,设置参数,执行sysctl -p时,报错(忽略该错误,一样可以安装成功)error: "net.bridge.bridge-nf-call-ip6tables" is an unknown keyerror: "net.bridge.bridge-nf-call-iptables" is an unknown keyerror: "net.bridge.bridge-nf-call-arptables" is an unknow

spark报错解决

19/03/04 18:18:42 ERROR Shell: Failed to locate the winutils binary in the hadoop binary path java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries. 查看Hadoop安装目录下是否缺少文件或者是查看环境变量的配置是否出错 原文地址:https://www.cnblogs.

windows svn post-commit 报错解决 error resolving case

在svn仓库目录下有个hooks目录,下面建一个 post-commit.cmd 文件,有代码提交到仓库,自动checkout到指定目录. @echo onSET REPOS=%1SET USER=%2SET SVN="C:/Program Files/VisualSVN Server/bin/svn.exe"SET DIR="D:/webroot"(call %SVN% update %DIR% --username root --password root --

【Unity3D】生成工程报错解决—UnityEditor.HostView:OnGUI() Error building Player: Couldn&#39;t build player because of unsupported data on target platform.

错误 错误1:An asset is marked as dont save, but is included in the build: unityEditor.HostView:OnGUI() 错误2:Building - Failed to write file: sharedassets0.assetsUnityEditor.HostView:OnGUI() 错误3:Error building Player: Couldn't build player because of unsup

android studio创建模拟器报错解决 emulator: ERROR: This AVD&#39;s configuration is missing a kernel file!!

android studio创建模拟器报错 emulator: ERROR: This AVD's configuration is missing a kernel file!! 的解决办法 原因有二:1 没有,解决办法通过sdk mangager 下载 2 找不到,解决办法看系统环境变量path(此种情况多数发生在android Studio和EclipseADT同时存在的情况下) 原因是在刚刚安装完毕的androidstudio的sdk目录下没有system-image目录,也许有但没有相

报错解决方法Error: Can&#39;t connect to local MySQL server through socket

Error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)Errno.: 2002解决方法一:因为你还没有启动mysql,当你启动mysql后,mysql.sock就会自动的生成../bin/safe_mysqld   --user=root   &(这是默认的).如果还没有,就是MYSQL权限没给,或其它原因还有就是 你的mysql是否启动了      启动后一般很难出现这个

关于mysql登录出现报错信息:ERROR 1045 (28000)的解决方法

登录mysql数据库出现报错信息ERROR 1045(28000)如下: [[email protected] ~]# mysql -uroot -p fanshine Enter password:  ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 分析:数据库存在空用户所致 解决: 停止mysql服务 [[email protected] ~]# service mysql

启动安卓模拟器报错 emulator: ERROR: x86_64 emulation currently requires hardware acceleration! CPU acceleration status:HAXM must be updated(version 1.1.1&lt;6.0.1) 解决办法

启动安卓模拟器报错 emulator: ERROR: x86_64 emulation currently requires hardware acceleration!  CPU acceleration status:HAXM must be updated(version 1.1.1<6.0.1) 解决办法: 在android sdk 安装目录下找到 \Android\sdk\extras\intel\Hardware_Accelerated_Execution_Manager 双击int