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/secondary_sort/input | 8 ++++++ hadoop/streaming/secondary_sort/secondary_sort.sh | 30 +++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 hadoop/streaming/secondary_sort/input create mode 100755 hadoop/streaming/secondary_sort/secondary_sort.sh (limited to 'hadoop/streaming/secondary_sort') diff --git a/hadoop/streaming/secondary_sort/input b/hadoop/streaming/secondary_sort/input new file mode 100644 index 0000000..5aa7ec9 --- /dev/null +++ b/hadoop/streaming/secondary_sort/input @@ -0,0 +1,8 @@ +0-*-1 a:1 a:2 a:3 +0-*-2 a:1 a:2 a:3 +0-*-10 a:1 a:2 a:3 +1-*-2 a:1 a:2 a:3 +2-*-0 a:1 a:2 a:3 +2-*-2 a:1 a:2 a:3 +3-*-3 a:1 a:2 a:3 +10-*-0 a:1 a:2 a:3 diff --git a/hadoop/streaming/secondary_sort/secondary_sort.sh b/hadoop/streaming/secondary_sort/secondary_sort.sh new file mode 100755 index 0000000..c45f381 --- /dev/null +++ b/hadoop/streaming/secondary_sort/secondary_sort.sh @@ -0,0 +1,30 @@ +#!/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=secondary_sort_out + +$HSTREAMING \ + -input input \ + -output $OUT \ + -partitioner org.apache.hadoop.mapred.lib.KeyFieldBasedPartitioner \ + -jobconf map.output.key.field.separator="-*-" \ + -jobconf mapred.text.key.partitioner.options="-k1,1n" \ + -mapper /bin/cat \ + -reducer org.apache.hadoop.mapred.lib.IdentityReducer \ + -jobconf mapred.output.key.comparator.class=org.apache.hadoop.mapred.lib.KeyFieldBasedComparator \ + -jobconf stream.num.map.output.key.fields=2 \ + -jobconf stream.map.output.field.separator="\t" \ + -jobconf mapred.text.key.comparator.options="-k1,1n -k2,2nr" \ + -jobconf mapred.reduce.tasks=3 + +hadoop dfs -get $OUT . +hadoop dfs -rmr $OUT +hadoop dfs -rm input + -- cgit v1.2.3