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 Quotas Guide</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> > <a href="http://hadoop.apache.org/">Hadoop</a> > <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"> |
---|
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.20 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 | |
---|
96 | |
---|
97 | </div> |
---|
98 | <!--+ |
---|
99 | |start Menu, mainarea |
---|
100 | +--> |
---|
101 | <!--+ |
---|
102 | |start Menu |
---|
103 | +--> |
---|
104 | <div id="menu"> |
---|
105 | <div onclick="SwitchMenu('menu_1.1', 'skin/')" id="menu_1.1Title" class="menutitle">Getting Started</div> |
---|
106 | <div id="menu_1.1" class="menuitemgroup"> |
---|
107 | <div class="menuitem"> |
---|
108 | <a href="index.html">Overview</a> |
---|
109 | </div> |
---|
110 | <div class="menuitem"> |
---|
111 | <a href="quickstart.html">Quick Start</a> |
---|
112 | </div> |
---|
113 | <div class="menuitem"> |
---|
114 | <a href="cluster_setup.html">Cluster Setup</a> |
---|
115 | </div> |
---|
116 | <div class="menuitem"> |
---|
117 | <a href="mapred_tutorial.html">Map/Reduce Tutorial</a> |
---|
118 | </div> |
---|
119 | </div> |
---|
120 | <div onclick="SwitchMenu('menu_1.2', 'skin/')" id="menu_1.2Title" class="menutitle">Programming Guides</div> |
---|
121 | <div id="menu_1.2" class="menuitemgroup"> |
---|
122 | <div class="menuitem"> |
---|
123 | <a href="commands_manual.html">Commands</a> |
---|
124 | </div> |
---|
125 | <div class="menuitem"> |
---|
126 | <a href="distcp.html">DistCp</a> |
---|
127 | </div> |
---|
128 | <div class="menuitem"> |
---|
129 | <a href="native_libraries.html">Native Libraries</a> |
---|
130 | </div> |
---|
131 | <div class="menuitem"> |
---|
132 | <a href="streaming.html">Streaming</a> |
---|
133 | </div> |
---|
134 | <div class="menuitem"> |
---|
135 | <a href="fair_scheduler.html">Fair Scheduler</a> |
---|
136 | </div> |
---|
137 | <div class="menuitem"> |
---|
138 | <a href="capacity_scheduler.html">Capacity Scheduler</a> |
---|
139 | </div> |
---|
140 | <div class="menuitem"> |
---|
141 | <a href="service_level_auth.html">Service Level Authorization</a> |
---|
142 | </div> |
---|
143 | <div class="menuitem"> |
---|
144 | <a href="vaidya.html">Vaidya</a> |
---|
145 | </div> |
---|
146 | <div class="menuitem"> |
---|
147 | <a href="hadoop_archives.html">Archives</a> |
---|
148 | </div> |
---|
149 | </div> |
---|
150 | <div onclick="SwitchMenu('menu_selected_1.3', 'skin/')" id="menu_selected_1.3Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">HDFS</div> |
---|
151 | <div id="menu_selected_1.3" class="selectedmenuitemgroup" style="display: block;"> |
---|
152 | <div class="menuitem"> |
---|
153 | <a href="hdfs_user_guide.html">User Guide</a> |
---|
154 | </div> |
---|
155 | <div class="menuitem"> |
---|
156 | <a href="hdfs_design.html">Architecture</a> |
---|
157 | </div> |
---|
158 | <div class="menuitem"> |
---|
159 | <a href="hdfs_shell.html">File System Shell Guide</a> |
---|
160 | </div> |
---|
161 | <div class="menuitem"> |
---|
162 | <a href="hdfs_permissions_guide.html">Permissions Guide</a> |
---|
163 | </div> |
---|
164 | <div class="menupage"> |
---|
165 | <div class="menupagetitle">Quotas Guide</div> |
---|
166 | </div> |
---|
167 | <div class="menuitem"> |
---|
168 | <a href="SLG_user_guide.html">Synthetic Load Generator Guide</a> |
---|
169 | </div> |
---|
170 | <div class="menuitem"> |
---|
171 | <a href="libhdfs.html">C API libhdfs</a> |
---|
172 | </div> |
---|
173 | </div> |
---|
174 | <div onclick="SwitchMenu('menu_1.4', 'skin/')" id="menu_1.4Title" class="menutitle">HOD</div> |
---|
175 | <div id="menu_1.4" class="menuitemgroup"> |
---|
176 | <div class="menuitem"> |
---|
177 | <a href="hod_user_guide.html">User Guide</a> |
---|
178 | </div> |
---|
179 | <div class="menuitem"> |
---|
180 | <a href="hod_admin_guide.html">Admin Guide</a> |
---|
181 | </div> |
---|
182 | <div class="menuitem"> |
---|
183 | <a href="hod_config_guide.html">Config Guide</a> |
---|
184 | </div> |
---|
185 | </div> |
---|
186 | <div onclick="SwitchMenu('menu_1.5', 'skin/')" id="menu_1.5Title" class="menutitle">Miscellaneous</div> |
---|
187 | <div id="menu_1.5" class="menuitemgroup"> |
---|
188 | <div class="menuitem"> |
---|
189 | <a href="api/index.html">API Docs</a> |
---|
190 | </div> |
---|
191 | <div class="menuitem"> |
---|
192 | <a href="jdiff/changes.html">API Changes</a> |
---|
193 | </div> |
---|
194 | <div class="menuitem"> |
---|
195 | <a href="http://wiki.apache.org/hadoop/">Wiki</a> |
---|
196 | </div> |
---|
197 | <div class="menuitem"> |
---|
198 | <a href="http://wiki.apache.org/hadoop/FAQ">FAQ</a> |
---|
199 | </div> |
---|
200 | <div class="menuitem"> |
---|
201 | <a href="releasenotes.html">Release Notes</a> |
---|
202 | </div> |
---|
203 | <div class="menuitem"> |
---|
204 | <a href="changes.html">Change Log</a> |
---|
205 | </div> |
---|
206 | </div> |
---|
207 | <div id="credit"></div> |
---|
208 | <div id="roundbottom"> |
---|
209 | <img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div> |
---|
210 | <!--+ |
---|
211 | |alternative credits |
---|
212 | +--> |
---|
213 | <div id="credit2"></div> |
---|
214 | </div> |
---|
215 | <!--+ |
---|
216 | |end Menu |
---|
217 | +--> |
---|
218 | <!--+ |
---|
219 | |start content |
---|
220 | +--> |
---|
221 | <div id="content"> |
---|
222 | <div title="Portable Document Format" class="pdflink"> |
---|
223 | <a class="dida" href="hdfs_quota_admin_guide.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br> |
---|
224 | PDF</a> |
---|
225 | </div> |
---|
226 | <h1> HDFS Quotas Guide</h1> |
---|
227 | <div id="minitoc-area"> |
---|
228 | <ul class="minitoc"> |
---|
229 | <li> |
---|
230 | <a href="#Name+Quotas">Name Quotas</a> |
---|
231 | </li> |
---|
232 | <li> |
---|
233 | <a href="#Space+Quotas">Space Quotas</a> |
---|
234 | </li> |
---|
235 | <li> |
---|
236 | <a href="#Administrative+Commands">Administrative Commands</a> |
---|
237 | </li> |
---|
238 | <li> |
---|
239 | <a href="#Reporting+Command">Reporting Command</a> |
---|
240 | </li> |
---|
241 | </ul> |
---|
242 | </div> |
---|
243 | |
---|
244 | |
---|
245 | <p> The Hadoop Distributed File System (HDFS) allows the administrator to set quotas for the number of names used and the |
---|
246 | amount of space used for individual directories. Name quotas and space quotas operate independently, but the administration and |
---|
247 | implementation of the two types of quotas are closely parallel. </p> |
---|
248 | |
---|
249 | |
---|
250 | <a name="N10010"></a><a name="Name+Quotas"></a> |
---|
251 | <h2 class="h3">Name Quotas</h2> |
---|
252 | <div class="section"> |
---|
253 | <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 |
---|
254 | directory creations fail if the quota would be exceeded. Quotas stick with renamed directories; the rename operation fails if |
---|
255 | operation would result in a quota violation. The attempt to set a quota will still succeed even if the directory would be in violation of the new |
---|
256 | quota. A newly created directory has no associated quota. The largest quota is <span class="codefrag">Long.Max_Value</span>. A quota of one |
---|
257 | forces a directory to remain empty. (Yes, a directory counts against its own quota!) </p> |
---|
258 | <p> Quotas are persistent with the <span class="codefrag">fsimage</span>. When starting, if the <span class="codefrag">fsimage</span> is immediately in |
---|
259 | violation of a quota (perhaps the <span class="codefrag">fsimage</span> was surreptitiously modified), |
---|
260 | a warning is printed for each of such violations. Setting or removing a quota creates a journal entry. </p> |
---|
261 | </div> |
---|
262 | |
---|
263 | |
---|
264 | <a name="N10029"></a><a name="Space+Quotas"></a> |
---|
265 | <h2 class="h3">Space Quotas</h2> |
---|
266 | <div class="section"> |
---|
267 | <p> The space quota is a hard limit on the number of bytes used by files in the tree rooted at that directory. Block |
---|
268 | allocations fail if the quota would not allow a full block to be written. Each replica of a block counts against the quota. Quotas |
---|
269 | stick with renamed directories; the rename operation fails if the operation would result in a quota violation. A newly created directory has no associated quota. |
---|
270 | 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. |
---|
271 | Directories don't use host file system space and don't count against the space quota. The host file system space used to save |
---|
272 | the file meta data is not counted against the quota. Quotas are charged at the intended replication factor for the file; |
---|
273 | changing the replication factor for a file will credit or debit quotas. </p> |
---|
274 | <p> Quotas are persistent with the <span class="codefrag">fsimage</span>. When starting, if the <span class="codefrag">fsimage</span> is immediately in |
---|
275 | violation of a quota (perhaps the <span class="codefrag">fsimage</span> was surreptitiously modified), a warning is printed for |
---|
276 | each of such violations. Setting or removing a quota creates a journal entry. </p> |
---|
277 | </div> |
---|
278 | |
---|
279 | |
---|
280 | <a name="N10042"></a><a name="Administrative+Commands"></a> |
---|
281 | <h2 class="h3">Administrative Commands</h2> |
---|
282 | <div class="section"> |
---|
283 | <p> Quotas are managed by a set of commands available only to the administrator. </p> |
---|
284 | <ul> |
---|
285 | |
---|
286 | |
---|
287 | <li> |
---|
288 | <span class="codefrag">dfsadmin -setQuota <N> <directory>...<directory></span> |
---|
289 | <br> Set the name quota to be <span class="codefrag">N</span> for |
---|
290 | each directory. Best effort for each directory, with faults reported if <span class="codefrag">N</span> is not a positive long integer, the |
---|
291 | directory does not exist or it is a file, or the directory would immediately exceed the new quota. </li> |
---|
292 | |
---|
293 | |
---|
294 | <li> |
---|
295 | <span class="codefrag">dfsadmin -clrQuota <directory>...<director></span> |
---|
296 | <br> Remove any name quota for each directory. Best |
---|
297 | 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 |
---|
298 | directory has no quota. </li> |
---|
299 | |
---|
300 | |
---|
301 | <li> |
---|
302 | <span class="codefrag">dfsadmin -setSpaceQuota <N> <directory>...<directory></span> |
---|
303 | <br> Set the space quota to be |
---|
304 | N bytes for each directory. This is a hard limit on total size of all the files under the directory tree. |
---|
305 | The space quota takes replication also into account, i.e. one GB of data with replication of 3 consumes 3GB of quota. N can also be specified with a binary prefix for convenience, for e.g. 50g for 50 gigabytes and |
---|
306 | 2t for 2 terabytes etc. Best effort for each directory, with faults reported if <span class="codefrag">N</span> is |
---|
307 | neither zero nor a positive integer, the directory does not exist or it is a file, or the directory would immediately exceed |
---|
308 | the new quota. </li> |
---|
309 | |
---|
310 | |
---|
311 | <li> |
---|
312 | <span class="codefrag">dfsadmin -clrSpaceQuota <directory>...<director></span> |
---|
313 | <br> Remove any space quota for each directory. Best |
---|
314 | 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 |
---|
315 | directory has no quota. </li> |
---|
316 | |
---|
317 | |
---|
318 | </ul> |
---|
319 | </div> |
---|
320 | |
---|
321 | |
---|
322 | <a name="N10076"></a><a name="Reporting+Command"></a> |
---|
323 | <h2 class="h3">Reporting Command</h2> |
---|
324 | <div class="section"> |
---|
325 | <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> |
---|
326 | <ul> |
---|
327 | |
---|
328 | |
---|
329 | <li> |
---|
330 | |
---|
331 | |
---|
332 | <span class="codefrag">fs -count -q <directory>...<directory></span> |
---|
333 | <br> With the <span class="codefrag">-q</span> option, also report the name quota |
---|
334 | value set for each directory, the available name quota remaining, the space quota value set, and the available space quota |
---|
335 | 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>. |
---|
336 | |
---|
337 | </li> |
---|
338 | |
---|
339 | |
---|
340 | </ul> |
---|
341 | </div> |
---|
342 | |
---|
343 | |
---|
344 | </div> |
---|
345 | <!--+ |
---|
346 | |end content |
---|
347 | +--> |
---|
348 | <div class="clearboth"> </div> |
---|
349 | </div> |
---|
350 | <div id="footer"> |
---|
351 | <!--+ |
---|
352 | |start bottomstrip |
---|
353 | +--> |
---|
354 | <div class="lastmodified"> |
---|
355 | <script type="text/javascript"><!-- |
---|
356 | document.write("Last Published: " + document.lastModified); |
---|
357 | // --></script> |
---|
358 | </div> |
---|
359 | <div class="copyright"> |
---|
360 | Copyright © |
---|
361 | 2008 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a> |
---|
362 | </div> |
---|
363 | <!--+ |
---|
364 | |end bottomstrip |
---|
365 | +--> |
---|
366 | </div> |
---|
367 | </body> |
---|
368 | </html> |
---|