wiki:NCHCCloudCourse100802/Demo1

Version 3 (modified by jazz, 14 years ago) (diff)

--

Hadoop Streaming with commands

jazz@hadoop:~$ hadoop fs -rmr input output
jazz@hadoop:~$ hadoop fs -put /etc/hadoop/conf input
jazz@hadoop:~$ hadoop jar hadoop-streaming.jar -input input -output output -mapper /bin/cat -reducer /usr/bin/wc
jazz@hadoop:~$ echo "sed -e \"s/ /\n/g\" | grep ." > streamingMapper.sh
jazz@hadoop:~$ echo "uniq -c | awk '{print \$2 \"\t\" \$1}'" > streamingReducer.sh
jazz@hadoop:~$ chmod a+x streamingMapper.sh
jazz@hadoop:~$ chmod a+x streamingReducer.sh
jazz@hadoop:~$ hadoop fs -rmr input output
jazz@hadoop:~$ hadoop fs -put /etc/hadoop/conf input
jazz@hadoop:~$ hadoop jar hadoop-streaming.jar -input input -output output -mapper streamingMapper.sh -reducer streamingReducer.sh -file streamingMapper.sh -file streamingReducer.sh