hdfs namenode元数据-fsimage

93ze6v8z  于 2021-06-02  发布在  Hadoop
关注(0)|答案(3)|浏览(441)

我知道在主节点中我们有name节点,它在两个文件中维护元数据。一个是fsimage,另一个是编辑日志。
所以这个fsimage最初是在hadoop系统启动时加载的,这个fsimage包含集群的目录结构和存储的数据。然后,对于发生的每个事务,都会更新编辑日志文件。
我的问题如下:
这些只是包含所有信息的文件(fsimage和editlogs)还是更多?
这是否意味着fsimage文件将只写入一次?
如果是,那么为什么总是复制到次要名称节点?这不是增加了要完成的任务吗?
假设我在hdfs中添加或删除了一个新文件;那么这个图像不会被更新吗?

bfrts1fy

bfrts1fy1#

是的,这是仅有的两个包含群集文件系统信息的文件
否。在每次重新启动名称节点时,fsimage都将写入磁盘,而在每次选中时,snn都将fsimage写入磁盘
在繁忙的集群上,editlog将快速增长。如果编辑日志非常大,那么下一次重新启动nn将需要更长的时间。snn将定期合并editlog和fsimage。snn还将作为fsimage的备份,以防您的nn磁盘出现故障。
对。fsimage将在主内存而不是磁盘中更新。此时,editlog将使用新事务在磁盘上更新

hlswsv35

hlswsv352#

要理解这一点,我们必须在hadoop运行时一步一步地进行详细介绍
加载fsimage后的namenode拥有数据存储在内存中的整个快照。
事务进入,信息存储在编辑日志中。
检查点节点/secondary namenode会定期(默认每小时一次)检索日志,并将它们与最新的fsimage合并,并将数据保留为检查点。此时,nn在内存中有图像,编辑日志被清空,最新的检查点作为图像存储在snn/cn上。
回答你的问题。
是的,只有两个文件
snn/cn上的fsimage将定期更新。当检查点被导入时,nn上的fsimage将被更新。这至少应该在重启时发生。
将editlog合并到fsimage是一项代价高昂的操作。为了合并数据,需要在namenode中进入安全模式。在这样的环境下这是不可能的
删除是一个日志,也是一个写入,所以它被存储在编辑日志中

e1xvtsh3

e1xvtsh33#

1) Yes only these two files are there .

    2) This is true for name node .

    3) It is copied to secondary name node for persistent storage , things would work fine un till name node is up ,lets say you have done so many changes like creating directories ,files ,putting the data to hdfs and so on so during run time this information is directly loaded into the memory but what if  namenode goes down so what ever new meta information was there which is not embedded  current fsimage  ,it would get lost permanently because when ever your system would come up it would load the fsimage into memory since its the old fsimage it won't have new changes . With this secondary name node we are preserving this changes in edit.log and finally edit.log file used for fsimage and new fsimage can be replaced with old one .
    4) process is when ever meta data gets changes ,this event gets written in edit.log file and after some specified interval these logs copied to secondary name node when their size gets too big then edit.log information is flushed into the form of fsimage. 
 current fsimage  would not get updated with addition or deletion of file ,these changes will directly cater in memory.

相关问题