请找到给出输出的火花核心示例,我可以看到每个单词的计数,其中火花流生成空零件文件。请帮忙。
Spark Core示例:
val file = sc.textFile("D:\\Spark-Learn\\FirstSparkStream\\logs\\shakespeare.raw")
val words = file.flatMap(line => line.split(" "))
val wordCounts = words.map(word => (word, 1)).reduceByKey(_ + _)
wordCounts.saveAsTextFile("D:\\Spark-Learn\\FirstSparkStream\\output\\output\\")
Spark Stream示例:
val ssc = new StreamingContext("spark://RSrini7:7077","Streaming Job",Seconds(30),"D:\\DevTools\\spark-1.2.0",List("D:\\Spark-Learn\\FirstSparkStream\\target\\scala-2.10\\simple-project_2.10-1.0.jar"))
val logData = ssc.textFileStream("D:\\Spark-Learn\\FirstSparkStream\\logs")
val words = logData.flatMap(_.split(" "))
val wordCounts = words.map(x => (x, 1)).reduceByKey(_ + _)
wordCounts.saveAsTextFiles("D:\\Spark-Learn\\FirstSparkStream\\output\\output","output")
这个例子,我在我的Windows 8机器上测试过。 master和worker在没有任何问题的情况下启动,在完成Job之后,控制台中没有警告或错误。
这是我的第一个问题,如果需要任何其他信息,请告诉我。