Changes between Initial Version and Version 1 of III140705/Lab21


Ignore:
Timestamp:
Jul 5, 2014, 8:34:57 AM (10 years ago)
Author:
jazz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • III140705/Lab21

    v1 v1  
     1◢ <[wiki:III140705/Lab20 實作二十]> | <[wiki:III140705 回課程大綱]> ▲ | <[wiki:III140705/Lab22 實作二十二] > ◣
     2
     3= 實作二十一 Lab21 =
     4
     5{{{
     6#!html
     7<p style="text-align: center;"><big style="font-weight: bold;"><big> 修改檔案輸入格式<br/> KeyValueTextInputFormat </big></big></p>
     8}}}
     9
     10[[PageOutline]]
     11
     12{{{
     13#!text
     14請先連線至 nodeN.3du.me , N 為您的報名編號
     15}}}
     16
     17{{{
     18cd ~/hadoop_labs/lab012
     19ant
     20mkdir -p kv_input
     21printf "A\t1\n" >  kv_input/input1
     22printf "B\t2\n" >> kv_input/input1
     23printf "C\t3\n" >> kv_input/input1
     24printf "A\t1\n" >  kv_input/input2
     25printf "C\t2\n" >> kv_input/input2
     26printf "B\t1\n" >> kv_input/input2
     27hadoop fs -put kv_input kv_input
     28hadoop jar WordCount.jar kv_input kv_output
     29hadoop fs -ls kv_output
     30hadoop fs -cat kv_output/part-*
     31
     32export HADOOP_CONF_DIR=~/hadoop/conf.local/
     33hadoop jar WordCount.jar kv_input kv_output
     34ls -al kv_output
     35cat kv_output/part-*
     36unset HADOOP_CONF_DIR
     37}}}
     38
     39 * Reference:
     40   * http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/lib/input/FileInputFormat.html
     41   * http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/lib/input/TextInputFormat.html
     42{{{
     43#!text
     44public class TextInputFormat
     45extends FileInputFormat<LongWritable,Text>
     46}}}
     47   * http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/lib/input/KeyValueTextInputFormat.html
     48{{{
     49#!text
     50public class KeyValueTextInputFormat
     51extends FileInputFormat<Text,Text>
     52}}}
     53   * http://hadoop.apache.org/docs/r1.0.4/api/org/apache/hadoop/mapreduce/lib/input/NLineInputFormat.html
     54{{{
     55#!text
     56public class NLineInputFormat
     57extends FileInputFormat<LongWritable,Text>
     58
     59NLineInputFormat which splits N lines of input as one split.
     60}}}
     61
     62== 實作習題 ==
     63
     64 <問題 1>