关闭访问墙 service iptables stop
hadoop dfs -mkdir input
hadoop dfs -copyFromLocal conf/* input
hadoop jar hadoop-examples-1.2.1.jar wordcount input output
bin/hadoop dfs -cat output/*
/usr/local/src/hadoop-1.2.1/bin/hadoop jar /usr/local/src/hadoop-1.2.1/contrib/streaming/hadoop-streaming-1.2.1.jar -file map.py -mapper map.py -file reduce.py -reducer reduce.py -input input/src.txt -output /output
HADOOP_CMD="/usr/local/src/hadoop-1.2.1/bin/hadoop"
STREAM_JAR_PATH="/usr/local/src/hadoop-1.2.1/contrib/streaming/hadoop-streaming-1.2.1.jar"
INPUT_FILE_PATH="/input/src.txt"
OUTPUT_PATH="/output"
$HADOOP_CMD fs -rmr $OUTPUT_PATH
$HADOOP_CMD jar $STREAM_JAR_PATH \
-input $INPUT_FILE_PATH \
-output $OUTPUT_PATH \
-mapper "python map.py" \
-reducer "python reduce.py"\
-file map.py \
-file reduce.py