val file = sc.textFile("hdfs://zhcloudil-lcnode04:8020/user/cloudil/wc_spark.txt")
val counts = file.flatMap(line => line.split(" ")).map(word => (word, 1)).reduceByKey(_ + _)
counts.saveAsTextFile("hdfs://zhcloudil-lcnode04:8020/user/cloudil/spark01")
cloudera manager安装spark后使用spark shell编写基于scala的world count
原文:http://www.cnblogs.com/coffeeplayer/p/4365917.html