HDFS存储支持压缩格式来存储压缩文件。我知道gzip压缩不支持夹板。想象一下,现在该文件是一个压缩大小为1 GB的压缩文件。现在我的问题是:
从此link我开始知道gzip格式使用DEFLATE存储压缩数据,DEFLATE将数据存储为一系列压缩块。
但我无法完全理解它并寻找广泛的解释。
来自gzip压缩文件的更多疑问:
DEFLATE
算法?我在这里看到广泛而详细的解释。
答案 0 :(得分:1)
如果zip文件格式不支持拆分,该文件将如何存储在HDFS中(块大小为64MB)?
所有DFS块都将存储在单个Datanode中。如果块大小为64 MB且文件为1 GB,则Datanode
具有16个DFS块(1 GB / 64 MB = 15.625)将存储1 GB文件。
这个1GB gzip压缩文件有多少块。
1 GB / 64 MB = 15.625~16 DFS块
复制因子如何适用于此文件(Hadoop群集复制因子为3。)
与任何其他文件相同。如果文件是可拆分的,则不做任何更改。如果文件不可拆分,则将标识具有所需块数的Datanode。在这种情况下,3个数据节点有16个可用的DFS块。
和
/** The class is responsible for choosing the desired number of targets
* for placing block replicas.
* The replica placement strategy is that if the writer is on a datanode,
* the 1st replica is placed on the local machine,
* otherwise a random datanode. The 2nd replica is placed on a datanode
* that is on a different rack. The 3rd replica is placed on a datanode
* which is on the same rack as the first replca.
*/
什么是DEFLATE算法?
DELATE是解压缩GZIP格式压缩文件的算法。
查看此幻灯片,了解不同zip文件变体的其他算法。
有关详细信息,请查看此presentation。