getMerge 在 Hadoop 中如何工作?
How does getMerge work in Hadoop?
我想知道 getMerge 命令在 OS/HDFS 级别如何工作。它将每个 byte/blocks 从一个文件复制到另一个文件,还是只是一个简单的文件描述符更改?它的成本是多少?
getmerge
Usage: hadoop fs -getmerge <src> <localdst> [addnl]
Takes a source directory and a destination file as input and concatenates files in src into the destination local file. Optionally addnl can be set to enable adding a newline character at the end of each file.
所以,为了回答你的问题,
Will it copy each and every byte/blocks from one file to another file
是,也不是。它将在给定源 目录 中找到包含文件的每个 HDFS 块,并将它们连接在一起成为本地文件系统上的单个文件。
a simple file descriptor change
不确定你的意思。 getmerge
不改变任何文件描述符;它只是将数据从 HDFS 读取到您的本地文件系统。
How costliest operation is it?
预计它与手动 cat
一样昂贵 - 对 HDFS 目录中的所有文件进行操作。
同样的操作
hadoop fs -getmerge /tmp/ /home/user/myfile
可以通过
实现
hadoop fs -cat /tmp/* > /home/user/myfile
昂贵的操作是获取许多文件指针并将这些记录通过网络传输到您的本地磁盘。
我想知道 getMerge 命令在 OS/HDFS 级别如何工作。它将每个 byte/blocks 从一个文件复制到另一个文件,还是只是一个简单的文件描述符更改?它的成本是多少?
getmerge
Usage: hadoop fs -getmerge <src> <localdst> [addnl]
Takes a source directory and a destination file as input and concatenates files in src into the destination local file. Optionally addnl can be set to enable adding a newline character at the end of each file.
所以,为了回答你的问题,
Will it copy each and every byte/blocks from one file to another file
是,也不是。它将在给定源 目录 中找到包含文件的每个 HDFS 块,并将它们连接在一起成为本地文件系统上的单个文件。
a simple file descriptor change
不确定你的意思。 getmerge
不改变任何文件描述符;它只是将数据从 HDFS 读取到您的本地文件系统。
How costliest operation is it?
预计它与手动 cat
一样昂贵 - 对 HDFS 目录中的所有文件进行操作。
hadoop fs -getmerge /tmp/ /home/user/myfile
可以通过
实现hadoop fs -cat /tmp/* > /home/user/myfile
昂贵的操作是获取许多文件指针并将这些记录通过网络传输到您的本地磁盘。