[Mac] Map/Reduceのチュートリアル

[Mac] Map/Reduceのチュートリアル公式のチュートリアルにあるJavaソースを使った操作の控え

1. 作業用フォルダ「wordcount」を作り、その中でJavaソースをコンパイルしJarにパッケージングする。
2. inputフォルダを作りそこにワードカウントするファイルを2つ用意し、フォルダをHDFSにPUTする
3. プログラムを実行しoutputに吐き出した結果を集計


cd ~/work/hadoop/
mkdir wordcount
cd wordcount
vi WordCount.java
mkdir classes
javac -classpath ~/work/hadoop/hadoop-0.20.2-core.jar WordCount.java -d classes
jar -cvf wordcount.jar -C classes/ .

mkdir input
cd input
vi file01
Hello World Bye World
vi file02
Hello Hadoop Goodbye Hadoop
~/work/hadoop/bin/hadoop dfs -put ./ input
~/work/hadoop/bin/hadoop dfs -ls
     drwxr-xr-x   - user supergroup          0 2011-05-15 08:06 /user/user/input

~/work/hadoop/bin/hadoop jar wordcount.jar org.myorg.WordCount /user/user/input /user/user/output
~/work/hadoop/bin/hadoop dfs -ls hdfs://localhost:9000/user/user/output
~/work/hadoop/bin/hadoop dfs -cat /user/user/java/output/part-00000 
     Bye 1
     Goodbye 1
     Hadoop 2
     Hello 2
     World 2

Usage: jar
{ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...
    -c  create new archive
    -t  list table of contents for archive
    -x  extract named (or all) files from archive
    -u  update existing archive
    -v  generate verbose output on standard output
    -f  specify archive file name
    -m  include manifest information from specified manifest file
    -e  specify application entry point for stand-alone application
        bundled into an executable jar file
    -0  store only; use no ZIP compression
    -M  do not create a manifest file for the entries
    -i  generate index information for the specified jar files
    -C  change to the specified directory and include the following file

Usage: java FsShell
    [-ls ]    [-lsr ]    [-du ]    [-dus ]    [-count[-q] ]    [-mv ]
    [-cp ]
    [-rm [-skipTrash] ]    [-rmr [-skipTrash] ]    [-expunge]
    [-put ... ]
    [-copyFromLocal ... ]
    [-moveFromLocal ... ]
    [-get [-ignoreCrc] [-crc] ]
    [-getmerge [addnl]]
    [-cat ]
    [-text ]
    [-copyToLocal [-ignoreCrc] [-crc] ]
    [-moveToLocal [-crc] ]
    [-mkdir ]    [-setrep [-R] [-w] ]
    [-touchz ]    [-test -[ezd] ]    [-stat [format] ]    [-tail [-f] ]
    [-chmod [-R] PATH...]
    [-chown [-R] [OWNER][:[GROUP]] PATH...]
    [-chgrp [-R] GROUP PATH...]
    [-help [cmd]]

Apache > Hadoop > Core > common > docs > r0.20.2

About the author
  • コメントを残す