gpt4 book ai didi

hadoop - cp 命令在 Hadoop 中如何工作?

转载 作者:可可西里 更新时间:2023-11-01 16:36:20 24 4
gpt4 key购买 nike

我正在阅读“Hadoop:权威指南”并解释我的问题让我引用书中的内容

distcp is implemented as a MapReduce job where the work of copying is done by the maps that run in parallel across the cluster. There are no reducers. Each file is copied by a single map, and distcp tries to give each map approximately the same amount of data by bucketing files into roughly equal allocations. By default, up to 20 maps are used, but this can be changed by specifying the -m argument to distcp.

在脚注中

Even for a single file copy, the distcp variant is preferred for large files since hadoop fs -cp copies the file via the client running the command.

我理解为什么 distcp 更适合收集文件,因为不同的映射器在单个文件上并行执行。但是当只复制一个文件时,为什么 distcp 在文件大时表现更好(根据脚注)。我才刚刚开始,所以如果解释了 hadoop 中的 cp 命令是如何工作的,以及“hadoop fs -cp 通过运行命令的客户端复制文件”是什么意思,那将会很有帮助。我理解Hadoop的写入过程,这在书中解释了其中形成了一个数据节点管道,每个数据节点负责将数据写入管道中的以下数据节点。

最佳答案

当“通过客户端”复制文件时,字节内容从 HDFS 流式传输到运行命令的本地节点,然后上传回目标 HDFS 位置。文件元数据并不像您期望的那样直接复制到数据节点之间的新位置。

将其与 distcp 进行比较,distcp 创建分布在多个主机上的更小的并行 cp 命令

关于hadoop - cp 命令在 Hadoop 中如何工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51979936/

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