我在Spark中有一个简单的程序:
/* SimpleApp.scala */
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._
import org.apache.spark.SparkConf
object SimpleApp {
def main(args: Array[String]) {
val conf = new SparkConf().setMaster("spark://10.250.7.117:7077").setAppName("Simple Application").set("spark.cores.max","2")
val sc = new SparkContext(conf)
val ratingsFile = sc.textFile("hdfs://hostname:8020/user/hdfs/mydata/movieLens/ds_small/ratings.csv")
//first get the first 10 records
println("Getting the first 10 records: ")
ratingsFile.take(10)
//get the number of records in the movie ratings file
println("The number of records in the movie list are : ")
ratingsFile.count()
}
}
当我尝试从spark-shell运行这个程序时,即我登录到名称节点(Cloudera安装)并在spark-shell上顺序运行命令:
val ratingsFile = sc.textFile("hdfs://hostname:8020/user/hdfs/mydata/movieLens/ds_small/ratings.csv")
println("Getting the first 10 records: ")
ratingsFile.take(10)
println("The number of records in the movie list are : ")
ratingsFile.count()
我得到了正确的结果,但如果我尝试从excel运行程序,没有资源分配给程序,在控制台日志中,我看到的是:
WARN TaskSchedulerImpl:初始作业未接受任何资源;检查群集UI以确保工作人员已注册并具有足够的资源
另外,在Spark UI中,我看到了:
此外,应该注意的是,这个版本的spark与Cloudera一起安装(因此没有工作节点出现)。
我应该怎么做才能使这项工作?
编辑:
我检查了HistoryServer,这些作业没有显示在那里(即使在不完整的应用程序中)