Your SlideShare is downloading. ×
0
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Hadoop, HDFS, MapReduce and Pig
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Hadoop, HDFS, MapReduce and Pig

452

Published on

Open presentation, training material. Presented at CSIRO Big Data 2.0 workshop in September 2013, North Ryde, Australia. Animated by hands-on examples.

Open presentation, training material. Presented at CSIRO Big Data 2.0 workshop in September 2013, North Ryde, Australia. Animated by hands-on examples.

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
452
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
37
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. ● ● ●
  • 2. ●
  • 3. ● ● ● ● ● ● ● ● ● ●
  • 4. ● ● ● ● ● ● ●
  • 5. ● ● ● ● ●
  • 6. ● ● ●
  • 7. ● ●
  • 8. ● ● ● ● > hadoop fs
  • 9. hadoop fs ● ● ● ● ● ● ●
  • 10. ● ● $ hadoop fs ls ● $ hadoop fs –help ls
  • 11. ● $ hadoop fs –ls <path> $ hadoop fs –ls / ● $ hadoop fs -ls $ hadoop fs –ls /user/cloudera ● ●
  • 12. ● $ hadoop fs -mkdir data $ hadoop fs -ls ● $ cd ~/bigdata/Exercises/hadoop/data $ ls -l $ hadoop fs –put mammograms.zip data
  • 13. ● ● ● http://localhost:50070 fsck: an HDFS utility $ hadoop fsck /user/cloudera/data/mammograms.zip -blocks -locations -files ● $ head -n 100 ato_centenary.txt | hadoop fs –put - data/ato100.txt
  • 14. ● $ head -n 1000 ato_centenary.txt | hadoop fs –put - data/ato100.txt ● put: ‘data/ato100.txt': File exists ● $ hadoop fs -rm data/ato100.txt $ head -n 1000 ato_centenary.txt | hadoop fs –put - data/ato100.txt
  • 15. ● $ hadoop fs -cat data/ato100.txt | less ● $ hadoop fs -get data/ato100.txt ato100.txt ● -mv, -cp, -rmdir, -stat ...
  • 16. ● ● ● ● ● ● ● ● ● ●
  • 17. ● ● ● ○ ■
  • 18. ● ○ ● ○ ● ○ ● ○ ○ ○
  • 19. ● ● ● ● ●
  • 20. ● ● ● ● ● $ javac –classpath `hadoop classpath` *.java ● $ jar cvf csiro.jar *.class ● $ hadoop jar csiro.jar Csiro input_dir output_dir
  • 21. ● ○ ● ● map(in_key, in_value) -> (inter_key, inter_value) list
  • 22. ● ○ ■ ■ ■ ●
  • 23. ● let map(key, value) = emit(key.toUpper(), value. toUpper()) (‘csiro’, ‘cci’) -> (‘CSIRO’, ‘CCI’) (‘csiro’, ‘cesre’) -> (‘CSIRO’, ‘CESRE’) (‘csiro’, ‘cmse’) -> (‘CSIRO’, ‘CMSE’) (‘toyota’, ‘yaris’) -> (‘TOYOTA’, ‘YARIS’)
  • 24. ● let map(key, value) = foreach char c in value: emit(key, c) (‘cci’, ‘csiro’) -> (‘cci’, ‘c’), (‘cci’, ’s’), (‘cci’, ‘i’), (‘cci’, ‘r’), (‘cci’, ‘o’) (‘open’, ‘nasa’) -> (‘open’, ‘n’), (‘open’, ’a’), (‘open’, ‘s’), (‘open’, ‘a’)
  • 25. ● let map(key, value) = emit(value.length(), value) (‘csiro’, ‘cci’) -> (‘3’, ‘cci’) (‘csiro’, ‘cesre’) -> (‘5’, ‘cesre’) (‘csiro’, ‘cmse’) -> (‘4’, ‘cmse’) (‘toyota’, ‘yaris’) -> (‘5’, ‘yaris’)
  • 26. ● ● ○ ○ ○ ● ○
  • 27. ● map(String input_key, String input_value) foreach word w in input_value: emit(w, 1) reduce(String output_key, Iterator<int> intermediate_values) set count = 0 foreach v in intermediate_values: count += v emit(output_key, count)
  • 28. ● Wordcount $ cd ~/bigdata/Exercises/hadoop/wordcount; ls WordCount.java WordMapper.java SumReducer.java ● $ javac –classpath `hadoop classpath` *.java ● $ jar cvf wc.jar *.class
  • 29. ● $ hadoop jar wc.jar WordCount data/ato100.txt ato_wc ● $ hadoop fs ls ato_wc $ hadoop fs -cat ato_wc/part-r-00000 | less $ hadoop fs -cat ato_wc/* | grep ‘ATO|CSIRO’ ● $ hadoop fs -rm -r ato_wc
  • 30. ● Average max temperature ●
  • 31. ● $ cd ~/bigdata/Exercises/hadoop/data $ less nsw_temp.csv $ less bom_data_Note.txt
  • 32. ● map(String input_key, String input_value): emit(input_value[3], input_value[5]) (‘IDCJAC0010,061087,1965,01,02,32.2,1,Y’)->(‘01’, 32.2) (‘IDCJAC0010,066062,1890,04,27,20.2,1,Y’)->(‘04’, 20.2) (‘IDCJAC0010,066062,2012,02,03,21.0,1,Y’)->(‘02’, 21.1)
  • 33. ● reduce(String month, Iterator<double> values) set count = 0 set sum = 0 foreach v in values: sum += v count++ set mean = sum/count emit(month, mean)
  • 34. ● $ cd ../averagetemp $ gedit *.java& AverageTemp.java AverageTempMapper.java AverageReducer.java ● $ cd ../wordcount $ gedit *.java&
  • 35. ● ● $ hadoop fs -put ../data/nsw_temp.csv data $ javac –classpath `hadoop classpath` *.java $ jar cvf avt.jar *.class $ hadoop jar avt.jar AverageTemp data/nsw_temp.csv avt
  • 36. ● $ hadoop fs -cat avt/part-1-00000 ~/bigdata/Exercises/hadoop/averagetemp/sample_solution
  • 37. ● ○ ○ ● ● ● ○
  • 38. ● ● ● ●
  • 39. ● ● ● ●
  • 40. ● ● ○ ○ ● ● ○
  • 41. ● ● ● ● ● ●
  • 42. ● ● ●
  • 43. ● ○ ○ ○ ● ○ ● ○ ○ ○
  • 44. ● ● ● ○ ○ ○ ○ ○ ○
  • 45. https://github.com/tomaszbednarz/pig-abc-toilets ● ● ● We have list of local ABC Radio stations in Australia We have list of all Public Toilets across Australia We want to find a closest toilet to a Radio Station Demonstration of: ● ● ● Data Schemas Use of external libraries Google Maps API
  • 46. ● ● ● ● ● ● ●
  • 47. ● ● ● ● ● ● ● ●

×