# cd ${SPARK_HOME}
# spark-shell
# cd ${SPARK_HOME}/conf
# cp ./log4j.properties.template log4j.properties
# vim log4j.properties
"log4j.logger.org.apache.spark.repl.Main=WARN" 을
"log4j.logger.org.apache.spark.repl.Main=INFO" 로변경
# spark-shell
scala> sc
res0: org.apache.spark.SparkContext ...
# spark-shell
scala> val file = sc.textFile("file:///usr/local/src/spark-2.2.0-bin-hadoop2.7/README.md")
scala> val words = file.flatMap(_.split(" "))
scala> val result = words.countByValue
scala> result.get("For").get
res1: Long = 3
Comments