[英]About hadoop hdfs filesystem rename
I am storing lots of data into hdfs. 我将大量数据存储到hdfs中。 And I need to move the files from one folder to another. 我需要将文件从一个文件夹移动到另一个文件夹。
May I ask generally how much is the cost of filesystem's rename method? 请问一般来说,文件系统重命名方法的成本是多少? Say I have to move terabytes of data. 说我必须移动TB的数据。
Thank you very much. 非常感谢你。
Rename is a metadata-only operation in HDFS. 重命名是HDFS中仅元数据的操作。 Therefore it is be very cheap like it is in a normal POSIX filesystem, too. 因此它也很便宜,就像在普通POSIX文件系统中一样。 No data is moved. 没有数据移动。 The only server involved is the namenode. 唯一涉及的服务器是名称节点。
The source code for the rename can be found here . 重命名的源代码可以在这里找到。 Pretty straight forward. 非常简单。
Moving files in HDFS or any file system if implemented properly involves changes to the name space and not moving of the actual data. 在HDFS或任何文件系统(如果实施得当)中移动文件涉及对名称空间的更改,而不涉及实际数据的移动。 Going through the code only changes in the name space (memory and edit log) in the Name node are done. 遍历代码仅完成了“名称”节点中名称空间的更改(内存和编辑日志)。
From the NameNode.java class 从NameNode.java类
Only the first part needs to be modified, block to machine list need not be. 只需要修改第一部分,而不必修改阻止到机器列表。 I haven't tried it out, but I guess it should be OK. 我还没有尝试过,但是我想应该没问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.