From 5ddc763ab9953eebdaf78af4eb72288d7955b310 Mon Sep 17 00:00:00 2001 From: Patrick Simianer
Date: Sat, 14 Jun 2014 19:03:21 +0200 Subject: cleanup --- hadoop/streaming/mapper/input | 10 ++++++++++ hadoop/streaming/mapper/mapper_test.py | 9 +++++++++ hadoop/streaming/mapper/mapper_test.sh | 23 +++++++++++++++++++++++ hadoop/streaming/mapper/mapper_test1.py | 9 +++++++++ hadoop/streaming/mapper/mapper_test1.sh | 24 ++++++++++++++++++++++++ 5 files changed, 75 insertions(+) create mode 100644 hadoop/streaming/mapper/input create mode 100644 hadoop/streaming/mapper/mapper_test.py create mode 100755 hadoop/streaming/mapper/mapper_test.sh create mode 100644 hadoop/streaming/mapper/mapper_test1.py create mode 100755 hadoop/streaming/mapper/mapper_test1.sh (limited to 'hadoop/streaming/mapper') diff --git a/hadoop/streaming/mapper/input b/hadoop/streaming/mapper/input new file mode 100644 index 0000000..338fd87 --- /dev/null +++ b/hadoop/streaming/mapper/input @@ -0,0 +1,10 @@ +0 1 a c +0 2 b c +0 3 c c +1 4 a c +1 5 b c +1 6 c c +1 7 d c +2 8 a c +2 9 b c +2 10 c c diff --git a/hadoop/streaming/mapper/mapper_test.py b/hadoop/streaming/mapper/mapper_test.py new file mode 100644 index 0000000..d358bda --- /dev/null +++ b/hadoop/streaming/mapper/mapper_test.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python2 + +import sys + + +if __name__ == "__main__": + for line in sys.stdin: + print line.upper() + diff --git a/hadoop/streaming/mapper/mapper_test.sh b/hadoop/streaming/mapper/mapper_test.sh new file mode 100755 index 0000000..f0c5da3 --- /dev/null +++ b/hadoop/streaming/mapper/mapper_test.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +hadoop dfs -put input input + +HADOOP_HOME=/usr/lib/hadoop +HADOOP_VERSION=0.20.2-cdh3u1 +JAR=contrib/streaming/hadoop-streaming-$HADOOP_VERSION.jar +HSTREAMING="$HADOOP_HOME/bin/hadoop jar $HADOOP_HOME/$JAR" + +OUT=mapper_test_out + +$HSTREAMING \ + -input input \ + -output $OUT \ + -mapper "python mapper.py" \ + -file mapper_test.py \ + -reducer org.apache.hadoop.mapred.lib.IdentityReducer \ + -jobconf mapred.reduce.tasks=3 + +hadoop dfs -get $OUT . +hadoop dfs -rmr $OUT +hadoop dfs -rm input + diff --git a/hadoop/streaming/mapper/mapper_test1.py b/hadoop/streaming/mapper/mapper_test1.py new file mode 100644 index 0000000..79c8aa6 --- /dev/null +++ b/hadoop/streaming/mapper/mapper_test1.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python2 + +import sys + + +if __name__ == "__main__": + for line in sys.stdin: + print "MYKEY\t%s"%line.upper() + diff --git a/hadoop/streaming/mapper/mapper_test1.sh b/hadoop/streaming/mapper/mapper_test1.sh new file mode 100755 index 0000000..475699f --- /dev/null +++ b/hadoop/streaming/mapper/mapper_test1.sh @@ -0,0 +1,24 @@ +#!/bin/sh + + +hadoop dfs -put input input + +HADOOP_HOME=/usr/lib/hadoop +HADOOP_VERSION=0.20.2-cdh3u1 +JAR=contrib/streaming/hadoop-streaming-$HADOOP_VERSION.jar +HSTREAMING="$HADOOP_HOME/bin/hadoop jar $HADOOP_HOME/$JAR" + +OUT=mapper_test1_out + +$HSTREAMING \ + -input input \ + -output $OUT \ + -mapper "python mapper1.py" \ + -file mapper_test1.py \ + -reducer org.apache.hadoop.mapred.lib.IdentityReducer \ + -jobconf mapred.reduce.tasks=3 + +hadoop dfs -get $OUT . +hadoop dfs -rmr $OUT +hadoop dfs -rm input + -- cgit v1.2.3