Я новичок в Spark, и я пытаюсь запустить работу scala в псевдораспределенной системе Hadoop.Как отправить работу Spark scala поверх Yarn, Hadoop
Hadoop 2.6 + Yarn + Spark 1.6.1 + scala 2.10.6 + JVM 8, все установлено с нуля.
Мое приложение Scala - это простой пример WordCount, я не знаю, что это за ошибка.
/usr/local/sparkapps/WordCount/src/main/scala/com/mydomain/spark/wordcount/WordCount.scala
package com.mydomain.spark.wordcount
import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.SparkContext._
object ScalaWordCount {
def main(args: Array[String]) {
val logFile = "/home/hduser/inputfile.txt"
val sparkConf = new SparkConf().setAppName("Spark Word Count")
val sc = new SparkContext(sparkConf)
val file = sc.textFile(logFile)
val counts = file.flatMap(_.split(" ")).map(word => (word, 1)).reduceByKey(_ + _)
counts.saveAsTextFile("/home/hduser/output")
}
}
SBT файл:
/usr/local/sparkapps/WordCount/WordCount.sbt
name := "ScalaWordCount"
version := "1.0"
scalaVersion := "2.10.6"
libraryDependencies += "org.apache.spark" %% "spark-core" % "1.6.1"
Compile:
$ cd /usr/local/sparkapps/WordCount/
$ sbt package
Отправить:
spark-submit --class com.mydomain.spark.wordcount.ScalaWordCount --master yarn-cluster /usr/local/sparkapps/WordCount/target/scala-2.10/scalawordcount_2.10-1.0.jar
Выход:
Exception in thread "main" org.apache.spark.SparkException: Application application_1460107053907_0003 finished with failed status
at org.apache.spark.deploy.yarn.Client.run(Client.scala:1034)
at org.apache.spark.deploy.yarn.Client$.main(Client.scala:1081)
at org.apache.spark.deploy.yarn.Client.main(Client.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:497)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:731)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Спарк Log File: http://pastebin.com/FnxFXimM
'Входной путь не существует: HDFS:// localhost: 9000/home/hduser/inputfile.txt' – swish