Giter Site home page Giter Site logo

new-repo1's Introduction

Hadoop MapReduce on the Cloud

This guide provides step-by-step instructions and results for running two mapreduce jobs on a managed hadoop cluster using Google Dataproc

Prerequiste

  • Create a dataproc cluster using the cloud console

image



  • Establish a SSH connection with the master node by clicking on the cluster and selecting the "vm instances" tab to expose the nodes

image


Question 1

Here we reate a Hadoop MapReduce application to find the maximum temperature in every day of the years 1901 and 1902 from the National Climate Data Center weather records. The records exit in two files which represent each year.

Finding the Max temperature without a combiner

  • Upload the map, reduce and data files on the local file system of the master node

image

  • Copy the data files from the local file system to HDFS

image

  • Run the Map Reduce job using the following command
hadoop jar /usr/lib/hadoop/hadoop-streaming.jar \
-file temperature_mapper.py \
-mapper 'python temperature_mapper.py' \
-file temperature_reducer.py \
-reducer 'python temperature_reducer.py' \
-input ./data \
-output /OutputFolder

image

  • Collect stats after running the job and check the output folder

image

  • Merge the result into a single output file
hadoop fs -getmerge /OutputFolder/ output.txt


Finding the max temperature with a combiner

  • Upload the map, combiner, reduce and data files on the local file system of the master node

image

- Copy the data files from the local file system to HDFS

image

  • Run the Map Reduce Job with the combiner using the follwing command
hadoop jar /usr/lib/hadoop/hadoop-streaming.jar \
-file temperature_mapper.py \
-mapper 'python temperature_mapper.py' \
-file temperature_reducer.py \
-reducer 'python temperature_reducer.py' \
-file temperature_combiner.py \
-combiner 'python temperature_combiner.py' \
-input ./data/ \
-output /OutputFolder

image

  • Collect stats after running the job and check the output folder

image



Question 2

Here we develop an efficient algorithm to find the most frequent 10 words using MapReduce fron a collection of text files. Top-N algorithm structure is shown below.



  • Upload the map, combiner, reduce and data files on the local file system of the master node

image

  • Copy the data files from the local file system to HDFS

image

  • Run the Map Reduce Job using the following command with only one reducer
hadoop jar /usr/lib/hadoop/hadoop-streaming.jar \
-file top_n_mapper.py \
-mapper 'python top_n_mapper.py' \
-file top_n_reducer.py \
-reducer 'python top_n_reducer.py' \
-input ./data/ \
-output /OutputFolder
-numReduceTasks 1

image

  • Collect stats

image


  • Get the results
hadoop fs -get /OutputFolder/part-00000 output.txt

image



ALL DONE!!!

new-repo1's People

Contributors

okemawo avatar github-classroom[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.