blob: 014f513d31077750cf8f3be4cb380680bdf58db6 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN"
"http://forrest.apache.org/dtd/document-v20.dtd">
<document>
<header>
<title>
名字空间配额管理指南
</title>
</header>
<body>
<p>
Hadoop分布式文件系统(HDFS)允许管理员为每个目录设置配额。
新建立的目录没有配额。
最大的配额是<code>Long.Max_Value</code>。配额为1可以强制目录保持为空。
</p>
<p>
目录配额是对目录树上该目录下的名字数量做硬性限制。如果创建文件或目录时超过了配额,该操作会失败。重命名不会改变该目录的配额;如果重命名操作会导致违反配额限制,该操作将会失败。如果尝试设置一个配额而现有文件数量已经超出了这个新配额,则设置失败。
</p>
<p>
配额和fsimage保持一致。当启动时,如果fsimage违反了某个配额限制(也许fsimage被偷偷改变了),则启动失败并生成错误报告。设置或删除一个配额会创建相应的日志记录。
</p>
<p>
下面的新命令或新选项是用于支持配额的。
前两个是管理员命令。
</p>
<ul>
<li>
<code>dfsadmin -setquota &lt;N> &lt;directory>...&lt;directory></code>
<br />
把每个目录配额设为<code>N</code>。这个命令会在每个目录上尝试,
如果<code>N</code>不是一个正的长整型数,目录不存在或是文件名,
或者目录超过配额,则会产生错误报告。
</li>
<li>
<code>dfsadmin -clrquota &lt;directory>...&lt;director></code><br />
为每个目录删除配额。这个命令会在每个目录上尝试,如果目录不存在或者是文件,则会产生错误报告。如果目录原来没有设置配额不会报错。
</li>
<li>
<code>fs -count -q &lt;directory>...&lt;directory></code><br />
使用<code>-q</code>选项,会报告每个目录设置的配额,以及剩余配额。
如果目录没有设置配额,会报告<code>none</code><code>inf</code>
</li>
</ul>
</body>
</document>