Spark實現WordCount單詞計數

spark連接到master:

這裏寫圖片描述

bin/spark-shell –master spark://master:7077

這裏寫圖片描述

連接成功。

這裏寫圖片描述

scala>sc.textFile(“hdfs://master:9000/root/data/input/data.txt”).flatMap(.split(” “)).map((,1)).reduceByKey(+).collect

刷新 http://192.168.222.100:8080/ 網頁
可以看到有一個應用啓動:

這裏寫圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章