hdfs_quota_admin_guide.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta content="Apache Forrest" name="Generator">
  6. <meta name="Forrest-version" content="0.8">
  7. <meta name="Forrest-skin-name" content="pelt">
  8. <title> HDFS Administrator Guide: Quotas </title>
  9. <link type="text/css" href="skin/basic.css" rel="stylesheet">
  10. <link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
  11. <link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
  12. <link type="text/css" href="skin/profile.css" rel="stylesheet">
  13. <script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
  14. <link rel="shortcut icon" href="images/favicon.ico">
  15. </head>
  16. <body onload="init()">
  17. <script type="text/javascript">ndeSetTextSize();</script>
  18. <div id="top">
  19. <!--+
  20. |breadtrail
  21. +-->
  22. <div class="breadtrail">
  23. <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://hadoop.apache.org/">Hadoop</a> &gt; <a href="http://hadoop.apache.org/core/">Core</a><script src="skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
  24. </div>
  25. <!--+
  26. |header
  27. +-->
  28. <div class="header">
  29. <!--+
  30. |start group logo
  31. +-->
  32. <div class="grouplogo">
  33. <a href="http://hadoop.apache.org/"><img class="logoImage" alt="Hadoop" src="images/hadoop-logo.jpg" title="Apache Hadoop"></a>
  34. </div>
  35. <!--+
  36. |end group logo
  37. +-->
  38. <!--+
  39. |start Project Logo
  40. +-->
  41. <div class="projectlogo">
  42. <a href="http://hadoop.apache.org/core/"><img class="logoImage" alt="Hadoop" src="images/core-logo.gif" title="Scalable Computing Platform"></a>
  43. </div>
  44. <!--+
  45. |end Project Logo
  46. +-->
  47. <!--+
  48. |start Search
  49. +-->
  50. <div class="searchbox">
  51. <form action="http://www.google.com/search" method="get" class="roundtopsmall">
  52. <input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">&nbsp;
  53. <input name="Search" value="Search" type="submit">
  54. </form>
  55. </div>
  56. <!--+
  57. |end search
  58. +-->
  59. <!--+
  60. |start Tabs
  61. +-->
  62. <ul id="tabs">
  63. <li>
  64. <a class="unselected" href="http://hadoop.apache.org/core/">Project</a>
  65. </li>
  66. <li>
  67. <a class="unselected" href="http://wiki.apache.org/hadoop">Wiki</a>
  68. </li>
  69. <li class="current">
  70. <a class="selected" href="index.html">Hadoop 0.19 Documentation</a>
  71. </li>
  72. </ul>
  73. <!--+
  74. |end Tabs
  75. +-->
  76. </div>
  77. </div>
  78. <div id="main">
  79. <div id="publishedStrip">
  80. <!--+
  81. |start Subtabs
  82. +-->
  83. <div id="level2tabs"></div>
  84. <!--+
  85. |end Endtabs
  86. +-->
  87. <script type="text/javascript"><!--
  88. document.write("Last Published: " + document.lastModified);
  89. // --></script>
  90. </div>
  91. <!--+
  92. |breadtrail
  93. +-->
  94. <div class="breadtrail">
  95. &nbsp;
  96. </div>
  97. <!--+
  98. |start Menu, mainarea
  99. +-->
  100. <!--+
  101. |start Menu
  102. +-->
  103. <div id="menu">
  104. <div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Documentation</div>
  105. <div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
  106. <div class="menuitem">
  107. <a href="index.html">Overview</a>
  108. </div>
  109. <div class="menuitem">
  110. <a href="quickstart.html">Hadoop Quick Start</a>
  111. </div>
  112. <div class="menuitem">
  113. <a href="cluster_setup.html">Hadoop Cluster Setup</a>
  114. </div>
  115. <div class="menuitem">
  116. <a href="mapred_tutorial.html">Hadoop Map/Reduce Tutorial</a>
  117. </div>
  118. <div class="menuitem">
  119. <a href="commands_manual.html">Hadoop Command Guide</a>
  120. </div>
  121. <div class="menuitem">
  122. <a href="hdfs_shell.html">Hadoop FS Shell Guide</a>
  123. </div>
  124. <div class="menuitem">
  125. <a href="distcp.html">Hadoop DistCp Guide</a>
  126. </div>
  127. <div class="menuitem">
  128. <a href="native_libraries.html">Hadoop Native Libraries</a>
  129. </div>
  130. <div class="menuitem">
  131. <a href="streaming.html">Hadoop Streaming</a>
  132. </div>
  133. <div class="menuitem">
  134. <a href="hadoop_archives.html">Hadoop Archives</a>
  135. </div>
  136. <div class="menuitem">
  137. <a href="hdfs_user_guide.html">HDFS User Guide</a>
  138. </div>
  139. <div class="menuitem">
  140. <a href="hdfs_design.html">HDFS Architecture</a>
  141. </div>
  142. <div class="menuitem">
  143. <a href="hdfs_permissions_guide.html">HDFS Admin Guide: Permissions</a>
  144. </div>
  145. <div class="menupage">
  146. <div class="menupagetitle">HDFS Admin Guide: Quotas</div>
  147. </div>
  148. <div class="menuitem">
  149. <a href="SLG_user_guide.html">HDFS Utilities</a>
  150. </div>
  151. <div class="menuitem">
  152. <a href="libhdfs.html">HDFS C API</a>
  153. </div>
  154. <div class="menuitem">
  155. <a href="hod_user_guide.html">HOD User Guide</a>
  156. </div>
  157. <div class="menuitem">
  158. <a href="hod_admin_guide.html">HOD Admin Guide</a>
  159. </div>
  160. <div class="menuitem">
  161. <a href="hod_config_guide.html">HOD Config Guide</a>
  162. </div>
  163. <div class="menuitem">
  164. <a href="capacity_scheduler.html">Capacity Scheduler</a>
  165. </div>
  166. <div class="menuitem">
  167. <a href="api/index.html">API Docs</a>
  168. </div>
  169. <div class="menuitem">
  170. <a href="jdiff/changes.html">API Changes</a>
  171. </div>
  172. <div class="menuitem">
  173. <a href="http://wiki.apache.org/hadoop/">Wiki</a>
  174. </div>
  175. <div class="menuitem">
  176. <a href="http://wiki.apache.org/hadoop/FAQ">FAQ</a>
  177. </div>
  178. <div class="menuitem">
  179. <a href="releasenotes.html">Release Notes</a>
  180. </div>
  181. <div class="menuitem">
  182. <a href="changes.html">Change Log</a>
  183. </div>
  184. </div>
  185. <div id="credit"></div>
  186. <div id="roundbottom">
  187. <img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
  188. <!--+
  189. |alternative credits
  190. +-->
  191. <div id="credit2"></div>
  192. </div>
  193. <!--+
  194. |end Menu
  195. +-->
  196. <!--+
  197. |start content
  198. +-->
  199. <div id="content">
  200. <div title="Portable Document Format" class="pdflink">
  201. <a class="dida" href="hdfs_quota_admin_guide.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
  202. PDF</a>
  203. </div>
  204. <h1> HDFS Administrator Guide: Quotas </h1>
  205. <div id="minitoc-area">
  206. <ul class="minitoc">
  207. <li>
  208. <a href="#Name+Quotas">Name Quotas</a>
  209. </li>
  210. <li>
  211. <a href="#Space+Quotas">Space Quotas</a>
  212. </li>
  213. <li>
  214. <a href="#Administrative+Commands">Administrative Commands</a>
  215. </li>
  216. <li>
  217. <a href="#Reporting+Command">Reporting Command</a>
  218. </li>
  219. </ul>
  220. </div>
  221. <p> The Hadoop Distributed File System (HDFS) allows the administrator to set quotas for the number of names used and the
  222. amount of space used for individual directories. Name quotas and space quotas operate independently, but the administration and
  223. implementation of the two types of quotas are closely parallel. </p>
  224. <a name="N10010"></a><a name="Name+Quotas"></a>
  225. <h2 class="h3">Name Quotas</h2>
  226. <div class="section">
  227. <p> The name quota is a hard limit on the number of file and directory names in the tree rooted at that directory. File and
  228. directory creations fail if the quota would be exceeded. Quotas stick with renamed directories; the rename operation fails if
  229. operation would result in a quota violation. The attempt to set a quota fails if the directory would be in violation of the new
  230. quota. A newly created directory has no associated quota. The largest quota is <span class="codefrag">Long.Max_Value</span>. A quota of one
  231. forces a directory to remain empty. (Yes, a directory counts against its own quota!) </p>
  232. <p> Quotas are persistent with the <span class="codefrag">fsimage</span>. When starting, if the <span class="codefrag">fsimage</span> is immediately in
  233. violation of a quota (perhaps the <span class="codefrag">fsimage</span> was surreptitiously modified),
  234. a warning is printed for each of such violations. Setting or removing a quota creates a journal entry. </p>
  235. </div>
  236. <a name="N10029"></a><a name="Space+Quotas"></a>
  237. <h2 class="h3">Space Quotas</h2>
  238. <div class="section">
  239. <p> The space quota is a hard limit on the number of bytes used by files in the tree rooted at that directory. Block
  240. allocations fail if the quota would not allow a full block to be written. Each replica of a block counts against the quota. Quotas
  241. stick with renamed directories; the rename operation fails if the operation would result in a quota violation. The attempt to
  242. set a quota fails if the directory would be in violation of the new quota. A newly created directory has no associated quota.
  243. The largest quota is <span class="codefrag">Long.Max_Value</span>. A quota of zero still permits files to be created, but no blocks can be added to the files.
  244. Directories don't use host file system space and don't count against the space quota. The host file system space used to save
  245. the file meta data is not counted against the quota. Quotas are charged at the intended replication factor for the file;
  246. changing the replication factor for a file will credit or debit quotas. </p>
  247. <p> Quotas are persistent with the <span class="codefrag">fsimage</span>. When starting, if the <span class="codefrag">fsimage</span> is immediately in
  248. violation of a quota (perhaps the <span class="codefrag">fsimage</span> was surreptitiously modified), a warning is printed for
  249. each of such violations. Setting or removing a quota creates a journal entry. </p>
  250. </div>
  251. <a name="N10042"></a><a name="Administrative+Commands"></a>
  252. <h2 class="h3">Administrative Commands</h2>
  253. <div class="section">
  254. <p> Quotas are managed by a set of commands available only to the administrator. </p>
  255. <ul>
  256. <li>
  257. <span class="codefrag">dfsadmin -setQuota &lt;N&gt; &lt;directory&gt;...&lt;directory&gt;</span>
  258. <br> Set the name quota to be <span class="codefrag">N</span> for
  259. each directory. Best effort for each directory, with faults reported if <span class="codefrag">N</span> is not a positive long integer, the
  260. directory does not exist or it is a file, or the directory would immediately exceed the new quota. </li>
  261. <li>
  262. <span class="codefrag">dfsadmin -clrQuota &lt;directory&gt;...&lt;director&gt;</span>
  263. <br> Remove any name quota for each directory. Best
  264. effort for each directory, with faults reported if the directory does not exist or it is a file. It is not a fault if the
  265. directory has no quota. </li>
  266. <li>
  267. <span class="codefrag">dfsadmin -setSpaceQuota &lt;N&gt; &lt;directory&gt;...&lt;directory&gt;</span>
  268. <br> Set the space quota to be
  269. N bytes for each directory. N can also be specified with a binary prefix for convenience, for e.g. 50g for 50 gigabytes and
  270. 2t for 2 terabytes etc. Best effort for each directory, with faults reported if <span class="codefrag">N</span> is
  271. neither zero nor a positive integer, the directory does not exist or it is a file, or the directory would immediately exceed
  272. the new quota. </li>
  273. <li>
  274. <span class="codefrag">dfsadmin -clrSpaceQuota &lt;directory&gt;...&lt;director&gt;</span>
  275. <br> Remove any space quota for each directory. Best
  276. effort for each directory, with faults reported if the directory does not exist or it is a file. It is not a fault if the
  277. directory has no quota. </li>
  278. </ul>
  279. </div>
  280. <a name="N10076"></a><a name="Reporting+Command"></a>
  281. <h2 class="h3">Reporting Command</h2>
  282. <div class="section">
  283. <p> An an extension to the <span class="codefrag">count</span> command of the HDFS shell reports quota values and the current count of names and bytes in use. </p>
  284. <ul>
  285. <li>
  286. <span class="codefrag">fs -count -q &lt;directory&gt;...&lt;directory&gt;</span>
  287. <br> With the <span class="codefrag">-q</span> option, also report the name quota
  288. value set for each directory, the available name quota remaining, the space quota value set, and the available space quota
  289. remaining. If the directory does not have a quota set, the reported values are <span class="codefrag">none</span> and <span class="codefrag">inf</span>.
  290. </li>
  291. </ul>
  292. </div>
  293. </div>
  294. <!--+
  295. |end content
  296. +-->
  297. <div class="clearboth">&nbsp;</div>
  298. </div>
  299. <div id="footer">
  300. <!--+
  301. |start bottomstrip
  302. +-->
  303. <div class="lastmodified">
  304. <script type="text/javascript"><!--
  305. document.write("Last Published: " + document.lastModified);
  306. // --></script>
  307. </div>
  308. <div class="copyright">
  309. Copyright &copy;
  310. 2008 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a>
  311. </div>
  312. <!--+
  313. |end bottomstrip
  314. +-->
  315. </div>
  316. </body>
  317. </html>