2015-02-08 59 views
0

。我使用-archives从本地机器上传tgz到hdfs任务工作目录,但是它并没有像文档所说的那样被解雇。我搜索了很多,没有任何运气。当编写hadoop streaming任务时,hadoop streaming不解压档案文件

这里是Hadoop的2.5.2 Hadoop的数据流任务开始的命令,很简单

hadoop jar /opt/hadoop/share/hadoop/tools/lib/hadoop-streaming-2.5.2.jar \ 
    -files mapper.sh 
    -archives /home/hadoop/tmp/test.tgz#test \ 
    -D mapreduce.job.maps=1 \ 
    -D mapreduce.job.reduces=1 \ 
    -input "/test/test.txt" \ 
    -output "/res/" \ 
    -mapper "sh mapper.sh" \ 
    -reducer "cat" 

和 “mapper.sh”

cat > /dev/null 
ls -l test 
exit 0 
在 “test.tgz”

在两个文件 “test.1.txt” 和 “test.2.txt”

echo "abcd" > test.1.txt 
echo "efgh" > test.2.txt 
tar zcvf test.tgz test.1.txt test.2.txt 

从上述任务

输出
lrwxrwxrwx 1 hadoop hadoop  71 Feb 8 23:25 test -> /tmp/hadoop-hadoop/nm-local-dir/usercache/hadoop/filecache/116/test.tgz 

但什么希望的可能是这样

-rw-r--r-- 1 hadoop hadoop 5 Feb 8 23:25 test.1.txt 
-rw-r--r-- 1 hadoop hadoop 5 Feb 8 23:25 test.2.txt 

那么,为什么test.tgz一直没有自动未解压的document说,是有任何其他方式使得“TGZ”是未解压

任何帮助,请,谢谢

+0

任何帮助,请 – Tios 2015-02-10 03:46:04

回答

1

我的错。在向hadoop.apache.org提交问题后。我被告知hadoop实际上已经解开了test.tgz。

尽管名称仍然是test.tgz,但它是一个未经过解密的搜索引擎。因此,这些文件可以像“cat test/test.1.txt”一样被读取。

0

这将未解压tar -zxvf test.tgz

+0

虽然此代码示例可能可以回答问题,但最好在答案中包含一些基本解释。现在看来,这个答案对未来的读者几乎没有任何价值。 – 2015-02-08 21:50:00

+0

其实我希望将“test.tgz”上传到流媒体任务开始的hdfs后,它会自动解压。如[文档](http://hadoop.apache.org/docs/stable/hadoop-mapreduce-lient/hadoop-mapreduce-client-core/HadoopStreaming.html#Making_Archives_Available_to_Tasks)所述。 “-archives选项允许您将jars本地复制到当前任务的工作目录,并自动unjar文件” – Tios 2015-02-09 00:51:06