summaryrefslogtreecommitdiff
path: root/hadoop/streaming/no_reducer
diff options
context:
space:
mode:
Diffstat (limited to 'hadoop/streaming/no_reducer')
-rw-r--r--hadoop/streaming/no_reducer/input8
-rwxr-xr-xhadoop/streaming/no_reducer/no_reducer.rb9
-rwxr-xr-xhadoop/streaming/no_reducer/no_reducer.sh23
3 files changed, 40 insertions, 0 deletions
diff --git a/hadoop/streaming/no_reducer/input b/hadoop/streaming/no_reducer/input
new file mode 100644
index 0000000..71ac1b5
--- /dev/null
+++ b/hadoop/streaming/no_reducer/input
@@ -0,0 +1,8 @@
+a
+b
+c
+d
+e
+f
+g
+h
diff --git a/hadoop/streaming/no_reducer/no_reducer.rb b/hadoop/streaming/no_reducer/no_reducer.rb
new file mode 100755
index 0000000..4410b93
--- /dev/null
+++ b/hadoop/streaming/no_reducer/no_reducer.rb
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+
+
+i = 0
+while l = STDIN.gets
+ puts "line #{i} (#{l.strip})"
+ i+=1
+end
+
diff --git a/hadoop/streaming/no_reducer/no_reducer.sh b/hadoop/streaming/no_reducer/no_reducer.sh
new file mode 100755
index 0000000..c32bfdd
--- /dev/null
+++ b/hadoop/streaming/no_reducer/no_reducer.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=no_reducer_out
+
+$HSTREAMING \
+ -input input \
+ -output $OUT \
+ -mapper "no_reducer.rb" \
+ -file "no_reducer.rb" \
+ -reducer NONE
+
+hadoop dfs -get $OUT .
+hadoop dfs -rmr $OUT
+hadoop dfs -rm input
+