如果我们使用小文件,HDFS中是否有任何内存丢失? [英] Is there any memory loss in HDFS if we use small files?

查看:104
本文介绍了如果我们使用小文件,HDFS中是否有任何内存丢失?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面我从Hadoop中引用 - 权威指南:
但是,请注意,小文件不会占用比存储文件原始内容所需的更多的磁盘空间。例如,一个1 MB的文件存储的块大小为128 MB,使用1 MB的磁盘空间,而不是128 MB,

这里是我的问题



<1> 1 MB文件存储的块大小为128 MB,使用1 MB磁盘空间,而不是128 MB。)hdfs如何使用此块中剩余的127M?



2)是否有机会在同一个块中存储另一个文件?

解决方案


  1. 1 MB文件存储在具有3个复制的128MB块中。然后该文件将存储在3个块中,并使用3 * 1 = 3 MB而不是3 * 128 = 384 MB。但它显示每个块的大小为128 MB。这仅仅是一个抽象,用于将元数据存储在namenode中,而不是实际使用的内存大小。


  2. 无法在单个存储中存储多个文件块。每个文件将被存储在一个单独的块中。

  3. > https://stackoverflow.com/a/21274388/3496666
  4. < a href =https://stackoverflow.com/a/15065274/3496666> https://stackoverflow.com/a/15065274/3496666

  5. https://stackoverflow.com/a/14109147/3496666


I have taken below Quoting from Hadoop - The Definitive Guide: Note, however, that small files do not take up any more disk space than is required to store the raw contents of the file. For example, a 1 MB file stored with a block size of 128 MB uses 1 MB of disk space, not 128 MB,

Here my questions

1) 1 MB file stored with a block size of 128 MB uses 1 MB of disk space, not 128 MB.) How does hdfs use the remaining 127M in this block?

2)Is there any chance to store another file in same block?

解决方案

  1. 1 MB file stored in 128MB block with 3 replication. Then the file will be stored in 3 blocks and uses 3*1=3 MB only not 3*128=384 MB. But it shows each the block size as 128 MB. It is just an abstraction to store the metadata in the namenode, but not an actual memory size used.

  2. No way to store more than a file in a single block. Each file will be stored in a separate block.

Reference:

  1. https://stackoverflow.com/a/21274388/3496666
  2. https://stackoverflow.com/a/15065274/3496666
  3. https://stackoverflow.com/a/14109147/3496666

这篇关于如果我们使用小文件,HDFS中是否有任何内存丢失?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆