test

来源:互联网 发布:java多线程日志输出 编辑:程序博客网 时间:2024/06/01 10:21
object WordCount {  def main(args:Array[String]): Unit ={    val sparkConf = new SparkConf().setMaster("Master:7077").setAppName("WordCount")    val ssc = new StreamingContext(sparkConf,Seconds(1))    val lines = ssc.socketTextStream("Master",9999)    val words = lines.flatMap(_.split(" "))    val wordCounts = words.map(x => (x,1)).reduceByKey(_+_)    wordCounts.print()    ssc.start()    ssc.awaitTermination()  }}
<strong>格式测试</strong>

0 0
原创粉丝点击