May 2017
Intermediate to advanced
294 pages
7h 33m
English
Hadoop MapReduce's word count, which takes at least three class files and one configuration file, namely project object model (POM), becomes very simple with the Spark shell. In this recipe, we are going to create a simple one-line text file, upload it to the Hadoop distributed file system (HDFS), and use Spark to count the occurrences of words. Let's see how:
$ mkdir words
$ cd words
$ echo "to be or not to be" > sh.txt
$ spark-shell
scala> val words = sc.textFile("hdfs://localhost:9000/user/hduser/words") ...Read now
Unlock full access