简体   繁体   English

关于hadoop HDFS文件系统重命名

[英]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

  • The NameNode controls two critical tables: NameNode控制两个关键表:
  • 1) filename->blocksequence (namespace) 1)filename-> blocksequence(命名空间)
  • 2) block->machinelist ("inodes") 2)块->机器列表(“ inodes”)

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.

相关问题 关于hadoop文件系统transferFromLocalFile - about hadoop filesystem transferFromLocalFile 是否可以从非HDFS文件系统HBASE连接HADOOP? - Is it possible to connect HADOOP from non HDFS filesystem HBASE? 方案没有文件系统:找不到 hdfs 和类 org.apache.hadoop.DistributedFileSystem - No FileSystem for scheme:hdfs and Class org.apache.hadoop.DistributedFileSystem not found 错字“ hdfs”给我:“ java.io.IOException:方案:hdfs没有文件系统”。 在hadoop 2.7.7上使用FileSystem lib - Typo in word “hdfs” gives me: “java.io.IOException: No FileSystem for scheme: hdfs”. Using FileSystem lib over hadoop 2.7.7 org.apache.hadoop.fs.FileSystem:提供者org.apache.hadoop.hdfs.DistributedFileSystem不是子类型 - org.apache.hadoop.fs.FileSystem: Provider org.apache.hadoop.hdfs.DistributedFileSystem not a subtype 获取可用于读取/写入HDFS的Hadoop FileSystem对象的正确方法是什么? - What is the correct way to get a Hadoop FileSystem object that can be used for reading from/writing to HDFS? Hadoop:使用Filesystem.append()在Map阶段在HDFS中更新文件时进行同步? - Hadoop: synchronization while updating file in HDFS in the Map stage using Filesystem.append()? 如何模拟hadoop文件系统 - How to mock hadoop filesystem Multiples Hadoop FileSystem实例 - Multiples Hadoop FileSystem instances hadoop 没有用于方案的文件系统:文件 - hadoop No FileSystem for scheme: file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM