1.1-所需软件

    暂无代码

1.2-安装Spark

    暂无代码

2.3-IDEA

2.4-Eclipse

    暂无代码

小结

代码2.1

import org.apache.spark.{SparkConf,SparkContext}
object WordCount {
	def main(args: Array[String]) {
		val conf = new SparkConf().setAppName("mySpark").setMaster("local")
		val sc = new SparkContext(conf)
		val rdd = sc.textFile(args(0))
		val wordcount = rdd.flatMap(_.split("\t")).map((_,1))
		.reduceByKey(_ + _)
		for(arg <- wordcount.collect())
		print(arg + " ")
		println()
		sc.stop()
	}
}