gpt4 book ai didi

hadoop - 将hadoop作业的输出发送到单个文件

转载 作者:行者123 更新时间:2023-12-02 21:46:06 25 4
gpt4 key购买 nike

我正在使用由多个文件组成的hadoop处理一些数据。现在,我希望hadoop在输出中仅发出文件。我设置以下参数。

    set mapred.reduce.tasks=1;
set hive.exec.reducers.max = 1;
set hive.exec.compress.output=true;
set hive.exec.compress.intermediate=true;
但是仍然不起作用。有人可以解释一下吗?
更新:
我在配置单元控制台中设置这些参数。而且,我的输出不是写入hdfs,而是写入Amazon s3。

最佳答案

很难说,因为我不知道您在哪里设置参数。对我而言,仅发出一个输出文件的最佳方法是在MR作业中使用ToolRunner实现。好的手册可以在这里Hadoop: Implementing the Tool interface for MapReduce driver找到。

比您可以像这样直接从CLI指定输出文件的数量:

-D mapred.reduce.tasks=NumberOfOutputs

也可以使用DFS命令 -getmerge:
hdfs dfs -getmerge sourceDirectory OutputFile.txt

希望能帮助到你

关于hadoop - 将hadoop作业的输出发送到单个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25197913/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com