diff --git a/hadoop-hdds/docs/content/feature/Quota.md b/hadoop-hdds/docs/content/feature/Quota.md index b82c97897193..ecab238f2f50 100644 --- a/hadoop-hdds/docs/content/feature/Quota.md +++ b/hadoop-hdds/docs/content/feature/Quota.md @@ -45,6 +45,20 @@ e. If the cluster is upgraded from old version less than 1.1.0, use of quota on f. If volume's quota is enabled then bucket's quota cannot be cleared. +2. Namespace quota + +Administrators should be able to define how many namespace a Volume or Bucket can use. The following settings for namespace quota are supported: + +a. By default, the namespace quota for volume and bucket is not enabled (thus unlimited quota). + +b. When volume namespace quota is enabled, the total number of buckets under the volume, cannot exceed the volume namespace quota. + +c. When bucket namespace quota is enabled, the total number of keys under the bucket, cannot exceed the bucket namespace quota. + +d. Linked buckets do not consume namespace quota. + +e. If the cluster is upgraded from old version less than 1.1.0, use of quota on older volumes and buckets(We can confirm by looking at the info for the volume or bucket, and if the quota value is -2 then volume or bucket is old) is not recommended. Since the old key is not counted to the bucket's namespace quota, the quota setting is inaccurate at this point. + ## Client usage ### Storage Space level quota Storage space level quotas allow the use of units such as KB (k), MB (m), GB (g), TB (t), PB (p), etc. Represents how much storage Spaces will be used. @@ -84,4 +98,42 @@ bin/ozone sh bucket clrquota --space-quota /volume1/bucket1 bin/ozone sh volume info /volume1 bin/ozone sh bucket info /volume1/bucket1 ``` -We can get the quota value and usedBytes in the info of volume and bucket. \ No newline at end of file +We can get the quota value and usedBytes in the info of volume and bucket. + +### Namespace quota +Namespace quota is a number that represents how many unique names can be used. This number cannot be greater than LONG.MAX_VALUE in Java. + +#### Volume Namespace quota +```shell +bin/ozone sh volume create --namespace-quota 100 /volume1 +``` +This means setting the namespace quota of Volume1 to 100. + +```shell +bin/ozone sh volume setquota --namespace-quota 1000 /volume1 +``` +This behavior changes the namespace quota of Volume1 to 1000. + +#### Bucket Namespace quota +```shell +bin/ozone sh bucket create --namespace-quota 100 /volume1/bucket1 +``` +That means bucket1 allows us to use 100 of namespace. + +```shell +bin/ozone sh bucket setquota --namespace-quota 1000 /volume1/bucket1 +``` +This behavior changes the quota for Bucket1 to 1000. + +#### Clear the quota for volume and bucket +```shell +bin/ozone sh volume clrquota --namespace-quota /volume1 +bin/ozone sh bucket clrquota --namespace-quota /volume1/bucket1 +``` + +#### Check quota and usedNamespace for volume and bucket +```shell +bin/ozone sh volume info /volume1 +bin/ozone sh bucket info /volume1/bucket1 +``` +We can get the quota value and usedNamespace in the info of volume and bucket. \ No newline at end of file diff --git a/hadoop-hdds/docs/content/feature/Quota.zh.md b/hadoop-hdds/docs/content/feature/Quota.zh.md index 3db9d9800803..eb6e0844519e 100644 --- a/hadoop-hdds/docs/content/feature/Quota.zh.md +++ b/hadoop-hdds/docs/content/feature/Quota.zh.md @@ -43,6 +43,20 @@ menu: f. 如果volume quota被启用,那么bucket quota将不能被清除。 +2. 命名空间配额 + + 管理员应当能够定义一个Volume或Bucket可以使用多少命名空间。目前支持命名空间的配额设置为: + + a. 默认情况下volume和bucket的命名空间配额不启用(即无限配额)。 + + b. 当volume命名空间配额启用时,该volume的bucket数目不能超过此配额。 + + c. 当bucket的命名空间配额启用时,该bucket的key数目不能超过此配额。 + + d. Linked bucket不消耗命名空间配额。 + + e. 如果集群从小于1.1.0的旧版本升级而来,则不建议在旧volume和bucket(可以通过查看volume或者bucket的info确认,如果quota值是-2,那么这个volume或者bucket就是旧的)上使用配额。由于旧的key没有计算到bucket的命名空间配额中,所以此时配额设置是不准确的。 + ## 客户端用法 ### Storage space级别配额 Storage space级别配额允许使用 KB(k),MB(m),GB(g),TB(t), PB(p)等单位。表示将使用多少个存储空间。 @@ -81,3 +95,40 @@ bin/ozone sh volume info /volume1 bin/ozone sh bucket info /volume1/bucket1 ``` 我们能够在volume和bucket的info中查看quota及usedBytes的值 + +### Namespace quota +命名空间配额是一个数字,其代表由多少个名字能够使用。这个数字不能超过Java long数据类型的最大值。 + +#### Volume Namespace quota +```shell +bin/ozone sh volume create --namespace-quota 100 /volume1 +``` +这意味着将volume1的命名空间配额设置为100。 + +```shell +bin/ozone sh volume setquota --namespace-quota 1000 /volume1 +``` +此行为将volume1的命名空间配额更改为1000。 + +#### Bucket Namespace quota +```shell +bin/ozone sh bucket create --namespace-quota 100 /volume1/bucket1 +``` +这意味着bucket1允许我们使用100的命名空间。 + +```shell +bin/ozone sh bucket setquota --namespace-quota 1000 /volume1/bucket1 +``` +该行为将bucket1的命名空间配额更改为1000。 + +#### 清除volume和bucket的配额 +```shell +bin/ozone sh volume clrquota --namespace-quota /volume1 +bin/ozone sh bucket clrquota --namespace-quota /volume1/bucket1 +``` +#### 查看volume和bucket的quota值以及usedNamespace +```shell +bin/ozone sh volume info /volume1 +bin/ozone sh bucket info /volume1/bucket1 +``` +我们能够在volume和bucket的info中查看quota及usedNamespace的值