HdfsQuotaAdminGuide.apt.vm 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. ~~ Licensed under the Apache License, Version 2.0 (the "License");
  2. ~~ you may not use this file except in compliance with the License.
  3. ~~ You may obtain a copy of the License at
  4. ~~
  5. ~~ http://www.apache.org/licenses/LICENSE-2.0
  6. ~~
  7. ~~ Unless required by applicable law or agreed to in writing, software
  8. ~~ distributed under the License is distributed on an "AS IS" BASIS,
  9. ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. ~~ See the License for the specific language governing permissions and
  11. ~~ limitations under the License. See accompanying LICENSE file.
  12. ---
  13. HDFS Quotas Guide
  14. ---
  15. ---
  16. ${maven.build.timestamp}
  17. HDFS Quotas Guide
  18. %{toc|section=1|fromDepth=0}
  19. * Overview
  20. The Hadoop Distributed File System (HDFS) allows the administrator to
  21. set quotas for the number of names used and the amount of space used
  22. for individual directories. Name quotas and space quotas operate
  23. independently, but the administration and implementation of the two
  24. types of quotas are closely parallel.
  25. * Name Quotas
  26. The name quota is a hard limit on the number of file and directory
  27. names in the tree rooted at that directory. File and directory
  28. creations fail if the quota would be exceeded. Quotas stick with
  29. renamed directories; the rename operation fails if operation would
  30. result in a quota violation. The attempt to set a quota will still
  31. succeed even if the directory would be in violation of the new quota. A
  32. newly created directory has no associated quota. The largest quota is
  33. Long.Max_Value. A quota of one forces a directory to remain empty.
  34. (Yes, a directory counts against its own quota!)
  35. Quotas are persistent with the fsimage. When starting, if the fsimage
  36. is immediately in violation of a quota (perhaps the fsimage was
  37. surreptitiously modified), a warning is printed for each of such
  38. violations. Setting or removing a quota creates a journal entry.
  39. * Space Quotas
  40. The space quota is a hard limit on the number of bytes used by files in
  41. the tree rooted at that directory. Block allocations fail if the quota
  42. would not allow a full block to be written. Each replica of a block
  43. counts against the quota. Quotas stick with renamed directories; the
  44. rename operation fails if the operation would result in a quota
  45. violation. A newly created directory has no associated quota. The
  46. largest quota is <<<Long.Max_Value>>>. A quota of zero still permits files
  47. to be created, but no blocks can be added to the files. Directories don't
  48. use host file system space and don't count against the space quota. The
  49. host file system space used to save the file meta data is not counted
  50. against the quota. Quotas are charged at the intended replication
  51. factor for the file; changing the replication factor for a file will
  52. credit or debit quotas.
  53. Quotas are persistent with the fsimage. When starting, if the fsimage
  54. is immediately in violation of a quota (perhaps the fsimage was
  55. surreptitiously modified), a warning is printed for each of such
  56. violations. Setting or removing a quota creates a journal entry.
  57. * Administrative Commands
  58. Quotas are managed by a set of commands available only to the
  59. administrator.
  60. * <<<hdfs dfsadmin -setQuota <N> <directory>...<directory> >>>
  61. Set the name quota to be N for each directory. Best effort for each
  62. directory, with faults reported if N is not a positive long
  63. integer, the directory does not exist or it is a file, or the
  64. directory would immediately exceed the new quota.
  65. * <<<hdfs dfsadmin -clrQuota <directory>...<directory> >>>
  66. Remove any name quota for each directory. Best effort for each
  67. directory, with faults reported if the directory does not exist or
  68. it is a file. It is not a fault if the directory has no quota.
  69. * <<<hdfs dfsadmin -setSpaceQuota <N> <directory>...<directory> >>>
  70. Set the space quota to be N bytes for each directory. This is a
  71. hard limit on total size of all the files under the directory tree.
  72. The space quota takes replication also into account, i.e. one GB of
  73. data with replication of 3 consumes 3GB of quota. N can also be
  74. specified with a binary prefix for convenience, for e.g. 50g for 50
  75. gigabytes and 2t for 2 terabytes etc. Best effort for each
  76. directory, with faults reported if N is neither zero nor a positive
  77. integer, the directory does not exist or it is a file, or the
  78. directory would immediately exceed the new quota.
  79. * <<<hdfs dfsadmin -clrSpaceQuota <directory>...<directory> >>>
  80. Remove any space quota for each directory. Best effort for each
  81. directory, with faults reported if the directory does not exist or
  82. it is a file. It is not a fault if the directory has no quota.
  83. * Reporting Command
  84. An an extension to the count command of the HDFS shell reports quota
  85. values and the current count of names and bytes in use.
  86. * <<<hadoop fs -count -q <directory>...<directory> >>>
  87. With the -q option, also report the name quota value set for each
  88. directory, the available name quota remaining, the space quota
  89. value set, and the available space quota remaining. If the
  90. directory does not have a quota set, the reported values are <<<none>>>
  91. and <<<inf>>>.