2011-06-15 67 views

回答

4

塊和文件存儲在HashMap中。所以你被綁定到Integer.MAX_VALUE。 所以一個目錄沒有任何限制,但是整個FileSystem。

+0

但是,由於s/w和h/w約束,框架可能不會真正縮放到該數量。 – 2011-08-03 04:53:30

6

http://blog.cloudera.com/blog/2009/02/the-small-files-problem/

在HDFS每個文件,目錄和塊被表示爲在名稱節點的存儲器中的對象,其每一個佔用150個字節,作爲一個經驗法則。因此,每個使用塊的1000萬個文件將使用大約3千兆字節的內存。當前硬件的問題比這個級別大得多。當然有十億個文件是不可行的。

1

這個問題特別提到了HDFS,但相關的問題是您可以在Hadoop集羣上存儲多少個文件。

如果您使用MapR的文件系統,這有不同的答案。在這種情況下,數十億個文件可以存儲在羣集中,而不會出現問題。

8

在現代的Apache Hadoop版本中,各種HDFS限制由名稱中的fs-limits配置屬性控制,所有這些都具有合理的默認值。這個問題特別提到了一個目錄中的兒童人數。這由dfs.namenode.fs-limits.max-directory-items定義,其默認值爲1048576

有關fs-limits配置屬性及其默認值的完整列表,請參閱hdfs-default.xml中的Apache Hadoop文檔。複製粘貼在這裏爲了方便:

<property> 
    <name>dfs.namenode.fs-limits.max-component-length</name> 
    <value>255</value> 
    <description>Defines the maximum number of bytes in UTF-8 encoding in each 
     component of a path. A value of 0 will disable the check.</description> 
</property> 

<property> 
    <name>dfs.namenode.fs-limits.max-directory-items</name> 
    <value>1048576</value> 
    <description>Defines the maximum number of items that a directory may 
     contain. Cannot set the property to a value less than 1 or more than 
     6400000.</description> 
</property> 

<property> 
    <name>dfs.namenode.fs-limits.min-block-size</name> 
    <value>1048576</value> 
    <description>Minimum block size in bytes, enforced by the Namenode at create 
     time. This prevents the accidental creation of files with tiny block 
     sizes (and thus many blocks), which can degrade 
     performance.</description> 
</property> 

<property> 
    <name>dfs.namenode.fs-limits.max-blocks-per-file</name> 
    <value>1048576</value> 
    <description>Maximum number of blocks per file, enforced by the Namenode on 
     write. This prevents the creation of extremely large files which can 
     degrade performance.</description> 
</property> 

<property> 
    <name>dfs.namenode.fs-limits.max-xattrs-per-inode</name> 
    <value>32</value> 
    <description> 
    Maximum number of extended attributes per inode. 
    </description> 
</property> 

<property> 
    <name>dfs.namenode.fs-limits.max-xattr-size</name> 
    <value>16384</value> 
    <description> 
    The maximum combined size of the name and value of an extended attribute 
    in bytes. It should be larger than 0, and less than or equal to maximum 
    size hard limit which is 32768. 
    </description> 
</property> 

所有這些設置使用合理的默認值時由Apache Hadoop的社區決定。通常建議用戶不要調整這些值,除非是在非常特殊的情況下。

+0

感謝您的詳細和明確的答案 – 2017-08-24 07:11:46

相關問題