请有人帮助我,我正试图在Haoop Yarn上安装spark,我得到这个错误:
org.apache.spark.SparkException: Yarn application has already ended! It might have been killed or unable to launch application master.
at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.waitForApplication(YarnClientSchedulerBackend.scala:113)
at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.start(YarnClientSchedulerBackend.scala:59)
at org.apache.spark.scheduler.TaskSchedulerImpl.start(TaskSchedulerImpl.scala:141)
at org.apache.spark.SparkContext.<init>(SparkContext.scala:379)
java.lang.NullPointerException
at org.apache.spark.sql.SQLContext.<init>(SQLContext.scala:141)
at org.apache.spark.sql.hive.HiveContext.<init>(HiveContext.scala:49)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
和hadoop守护进程:
4064 SecondaryNameNode
3478 NameNode
4224 ResourceManager
4480 NodeManager
3727 DataNode
6279 Jps
和bash文件:
export JAVA_HOME=/home/user/hadoop-two/jdk1.7.0_71
export HADOOP_INSTALL=/home/user/hadoop-two/hadoop-2.6.0
export PATH=$PATH:$HADOOP_INSTALL/bin
export PATH=$PATH:$HADOOP_INSTALL/sbin
export HADOOP_MAPRED_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_HOME=$HADOOP_INSTALL
export HADOOP_HDFS_HOME=$HADOOP_INSTALL
export YARN_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_INSTALL/lib"
export HADOOP_CONF_DIR=$HADOOP_INSTALL/etc/hadoop
export YARN_CONF_DIR=$HADOOP_INSTALL/etc/hadoop
export SPARK_HOME=/home/user/hadoop-two/spark-1.4.0
安装Spark,并配置上面设置的环境变量。配置conf/spark-env.sh
文件中的JAVA_HOME and HADOOP_CONF_DIR
:
export HADOOP_CONF_DIR=/home/user/hadoop-2.7.1/etc/hadoop
export JAVA_HOME=/home/user/jdk1.8.0_60
和在spark Conf目录下定义从服务器(将从服务器的dns名称放入):
conf/slaves
并使用命令
在YARN上启动spark:bin/spark-shell --master yarn-client
that It You done !!!!