Hands-On Big Data Processing and Analysis Guide

spark hands on n.w
1 / 6
Embed
Share

Explore practical examples and instructions for analyzing log files, running Scala scripts, implementing word count, editing hosts files, and loading data to HDFS. Enhance your understanding of big data processing through step-by-step tutorials.

  • Big Data Processing
  • Data Analysis
  • Scala Scripting
  • HDFS
  • Log Files

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Spark Hands On

  2. Example 1: Analyzing the Log. val file = sc.textFile("hdfs://sandbox-hdp.hortonworks.com:8020/tmp/littlelog.csv") file.collect().foreach(println) val fltr = file.filter(_.length > 0) val keys = fltr.map(_.split(",")).map(a => a(5)) val stateCnt = keys.map(key => (key,1)) stateCnt.collect().foreach(println) val lastMap = stateCnt.countByKey

  3. Put Interactive Scala Statement in a File Run the file on scala shell scala> :load logAnalyzer.scala

  4. Wordcount example var count = file.flatMap(Record=>Record.split(" ")).map(W=>(W, 1L)).reduceByKey(_+_).collect

  5. Appendix Edit hosts file Go to C:\Windows\System32\drivers\etc

  6. Load littlelog.csv to hdfs hadoop fs -put /tmp/littlelog.csv /tmp/

More Related Content