真的需要你的帮助来理解,我做错了什么.
我的实验的目的是以编程方式运行spark作业,而不是使用./spark-shell或./spark-submit(这些都适用于我)
环境:我使用./spark-ec2脚本创建了一个包含1个master和1个worker的Spark Cluster
但是,当我尝试运行打包在jar中的代码时,群集看起来很好:
val logFile = "file:///root/spark/bin/README.md"
val conf = new SparkConf()
conf.setAppName("Simple App")
conf.setJars(List("file:///root/spark/bin/hello-apache-spark_2.10-1.0.0-SNAPSHOT.jar"))
conf.setMaster("spark://ec2-54-89-51-36.compute-1.amazonaws.com:7077")
val sc = new SparkContext(conf)
val logData = sc.textFile(logFile, 2).cache()
val numAs = logData.filter(_.contains("a")).count()
val numBs = logData.filter(_.contains("b")).count()
println(s"1. Lines with a: $numAs, Lines with b: $numBs")
Run Code Online (Sandbox Code Playgroud)
我得到一个例外:
*[info] Running com.paycasso.SimpleApp
14/09/05 14:50:29 INFO SecurityManager: Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
14/09/05 14:50:29 INFO SecurityManager: Changing view acls to: root
14/09/05 14:50:29 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with …Run Code Online (Sandbox Code Playgroud)