Mostrar mensagens com a etiqueta tutorial. Mostrar todas as mensagens
Mostrar mensagens com a etiqueta tutorial. Mostrar todas as mensagens

sexta-feira, 18 de maio de 2012

[EN] - Big Data Helper - Part 5 - MapReduce

And this post will (I promise) show you how to run a simple mapreduce job.
I've mentioned mapreduce a couple of time.
But what is a mapreduce job? Well, a mapreduce job (for this I won't resort to the documentation, hope it is clear and correct) is a process that consists of two parts: the Map, and the Reduce.


The Map part, takes the data (in a way that you specify) and breaks it into individual pieces (more on this later).
The Reduce part, takes all the individual pieces and groups them into meaningful information / results.
Unclear? Well, to simplify (for those familiar with SQL), the reduce basically works like a Group By clause, and the Reducer code can do SUM, AVG, COUNT and so forth, as well as some greater complexity operations.


Specific example (Wordcount) (with another file):
Well, on the upper picture, you first have a file with some words. Then, the Mapper (Map program) breaks the file into words, and associates a 1 with the word and creates several touples.
After that, the Reducer (Reduce program) checks all the individual touples, and groups them by the word, summing all the 1s.
This for a simple WordCount MapReduce task.


To run the WordCount example (that is shipped with hadoop as a sample) just run (we will use the file discussed on http://pinelasgarden.blogspot.pt/2012/05/en-big-data-helper-part-3-loading-data.html):

step 1 and 2 (click to enlarge)
  1. cd /usr/lib/hadoop-0.20 (to find the examples.jar)
  2. hadoop jar hadoop-0.20.2-cdh3u0-examples.jar wordcount sapwc sap.wc.out (to run the mapreduce job)
  3. hadoop dfs -getmerge sap.wc.out sapOUT (to get the file out)
step 3 (click to enlarge)
When checking the output file you'll find the expected output.
Remember, that the description of the work of the Mapper and Reducer are specific for the Wordcount application. With other goals/purposes, the mapper/reducer would be responsible for different outputs.

Thank you.

p.s. - to sort this output use
$ sort -rnk 2 sapOUT


All done! congrats! your first map reduce job.
Lesson 6 (I think it's 6) will show you how to write your own mapreduce functions (a basic example).


Thank you.


-- ====================

Other Tutorial Links (to remove any doubts):

http://pinelasgarden.blogspot.pt/2012/04/en-big-data-helper-part-1-concepts.html
http://pinelasgarden.blogspot.pt/2012/04/en-big-data-helper-part-2-getting.html
http://pinelasgarden.blogspot.pt/2012/05/en-big-data-helper-part-3-loading-data.html
http://pinelasgarden.blogspot.pt/2012/05/en-big-data-helper-part-4-pig.html


terça-feira, 15 de maio de 2012

[EN] - Big Data Helper - Part 4 - Pig

Before running some mapreduce jobs, let me talk a little about Apache Pig.
Apache Pig (http://pig.apache.org/) is a:
"platform for analyzing large data sets that consists of a high-level language for expressing data analysis programs"


With pig you use a CLI and write Pig Latin (specific) commands to analyse the data.
http://pig.apache.org/docs/r0.7.0/piglatin_ref2.html

Specific Example:
we are going to use a csv file with some random data about car makers.


Now that we have the file, we are going to load the file into HDFS (like we did on lesson 3 http://pinelasgarden.blogspot.pt/2012/05/en-big-data-helper-part-3-loading-data.html) and then, import the file with pig. The next image represents just that.

After loading the file into HDFS, we load the content to a PIG variable, filter out the heading, and create a "table".
You can see by the next screen, that the "table" is indeed in the HDFS, along with the base file (auto.csv).



Hope that it was clear enough.

Thanks.




-- ====================

Other Tutorial Links



http://pinelasgarden.blogspot.pt/2012/04/en-big-data-helper-part-1-concepts.html
http://pinelasgarden.blogspot.pt/2012/04/en-big-data-helper-part-2-getting.html
http://pinelasgarden.blogspot.pt/2012/05/en-big-data-helper-part-3-loading-data.html
http://pinelasgarden.blogspot.pt/2012/05/en-big-data-helper-part-5-mapreduce.html

segunda-feira, 14 de maio de 2012

[EN] - Big Data Helper - Part 3 - Loading Data (files)

Ok, so you have the environment ready, and you have a basic understanding of some of the components of Hadoop. Now, what can you do, and how?
Well, to get started we need DATA. So what can we do?


Source data can have many forms. We will discuss two sources: files and databases.
On this post we will discuss files.


Steps:
  1. [S]FTP some file(s) to your environment's filesystem (with filezilla for example);
  2. Load you data to the HDFS filesystem
    1. $ hadoop fs -copyFromLocal sap.csv .
  3. Voilá. All done.


The command at 2.1, copies a file named sap.csv to the user's root folder on the HDFS filesystem.
you can get more options with
$ hadoop fs -help

You are ready to do some more interesting stuff. The final purpose of Hadoop: running MapReduce jobs (at least this one of the ways of loading).

Thank you.




-- ====================

Other Tutorial Links




http://pinelasgarden.blogspot.pt/2012/04/en-big-data-helper-part-1-concepts.html
http://pinelasgarden.blogspot.pt/2012/04/en-big-data-helper-part-2-getting.html
http://pinelasgarden.blogspot.pt/2012/05/en-big-data-helper-part-4-pig.html
http://pinelasgarden.blogspot.pt/2012/05/en-big-data-helper-part-5-mapreduce.html

sexta-feira, 6 de abril de 2012

[EN] - Big Data Helper - Part 2 - Getting Started

After the Concepts post


Now it is time to really get our hands ready to actually DO something. Well what do you need?
There are (at least) two choices:
1 - setup your own environment from scratch
2 - get a pre-built environment to start playing around in minutes.


Plan #1
- go to http://hadoop.apache.org/ and download all the necessary binaries, install an operating system (not in this order) and configure all the necessary layers.


Plan #2
- go to https://ccp.cloudera.com/display/SUPPORT/Downloads and download the Cloudera CDH virtual machine files and just use VMWare Player to get started (for example)
- go to http://www.mapr.com/download and download the MapR M3 virtual machine files to get started
- go to <insert other link here> (I don't know any other companies supplying such resources).


After this you are ready to go.
What can be done with these VMs, will be discussed in later posts. 


For the rest of these series of posts, I will be using the Cloudera CDH3u3 distribution.


Until then.
Thank you.




-- ====================

Other Tutorial Links



http://pinelasgarden.blogspot.pt/2012/04/en-big-data-helper-part-1-concepts.html
http://pinelasgarden.blogspot.pt/2012/05/en-big-data-helper-part-3-loading-data.html
http://pinelasgarden.blogspot.pt/2012/05/en-big-data-helper-part-4-pig.html
http://pinelasgarden.blogspot.pt/2012/05/en-big-data-helper-part-5-mapreduce.html

quarta-feira, 4 de abril de 2012

[EN] - Big Data Helper - Part 1 - Concepts

Well, after something like a year, hunting around for information about big data, I thought it was the time to share some useful information that might help those curious about this "technology" (this is not a correct term, but bear with me).


The image to the left should be extremely familiar to you. If not, I'll shed some light on it like pretty soon.


First of all let's define Big Data.


Big Data is (commonly) defined by three dimensions:
- Velocity
- Volume 
- Variety


Velocity is due to the speed at which data is generated, Volume as to the amount of data generated per small time unit, and final variety due to the different types of source data (e.t. files, audio, video, geospatial, structured, unstructured).


Hadoop (http://hadoop.apache.org/):
"The Apache Hadoop software library is a framework that allows for the distributed processing of large data sets across clusters of computers using a simple programming model. "


So, basically Hadoop gives you a tool to analyze your Big Data.

Now the Hadoop framework is composed of several components.
The basic ones:
  • Hadoop Common (standard libraries);
  • Hadoop Distributed File System (HDFS) - file system for high throughput;
  • Hadoop MapReduce - A software that allows you to distribute data processing load across several nodes of a cluster.
Aside from that there are some possible and useful aditions:
  • Avro
  • Cassandra
  • Chukwa
  • HBase
  • Hive
  • Mahout
  • Pig
  • Zookeeper
  • Lucene
Some of these concepts will be described in more detail across the next posts.
This was a simple intro.
Hope it boosted your curiosity, or helped you learn something.
Stay tuned.
Thanks.



-- ====================

Other Tutorial Links




http://pinelasgarden.blogspot.pt/2012/04/en-big-data-helper-part-2-getting.html
http://pinelasgarden.blogspot.pt/2012/05/en-big-data-helper-part-3-loading-data.html
http://pinelasgarden.blogspot.pt/2012/05/en-big-data-helper-part-4-pig.html
http://pinelasgarden.blogspot.pt/2012/05/en-big-data-helper-part-5-mapreduce.html