Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
courses:mapreduce-tutorial:step-4 [2012/01/24 21:29] straka |
courses:mapreduce-tutorial:step-4 [2012/01/31 09:40] (current) straka Change Perl commandline syntax. |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== MapReduce Tutorial : Counters ====== | ====== MapReduce Tutorial : Counters ====== | ||
- | Sometimes it is useful to count events differently than outputting them (key, value) pairs. For that reason Hadoop offers simple counter framework. | + | Sometimes it is useful to count events differently than outputting them as (key, value) pairs. For that reason Hadoop offers simple counter framework. |
+ | |||
+ | Hadoop maintains a collection of pre-defined and user-defined counters. Every counter is identified by its group name and counter name. The group name and counter name is an arbitrary string -- for example group " | ||
<code perl> | <code perl> | ||
sub map { | sub map { | ||
my ($self, $key, $value, $context) = @_; | my ($self, $key, $value, $context) = @_; | ||
- | + | ||
- | $context-> | + | $context-> |
} | } | ||
</ | </ | ||
+ | |||
+ | At the end of computation, | ||
===== Exercise ===== | ===== Exercise ===== | ||
- | Run a MR job on / | + | Run a Hadoop |
+ | wget --no-check-certificate ' | ||
+ | # NOW EDIT THE FILE | ||
+ | # $EDITOR step-4-exercise.pl | ||
+ | rm -rf step-4-out-ex; | ||
+ | less step-4-out-ex/ | ||
+ | |||
+ | ==== Solution ==== | ||
+ | You can also download the solution {{: | ||
+ | wget --no-check-certificate ' | ||
+ | # NOW VIEW THE FILE | ||
+ | # $EDITOR step-3-solution.pl | ||
+ | rm -rf step-4-out-sol; | ||
+ | less step-4-out-sol/ | ||
- | {{.:step-4-solution.txt|Solution.pl}} | + | ---- |
+ | < | ||
+ | <table style=" | ||
+ | <tr> | ||
+ | <td style=" | ||
+ | <td style=" | ||
+ | <td style=" | ||
+ | </tr> | ||
+ | </ | ||
+ | </ |