# Alluxio 命名空间中已有两个已有挂载点
$ bin/alluxio mount list
Listing all mount points
s3a://alluxio-jliu/ on /s3/ properties={...}
file:///Documents/Alluxio/underFSStorage/ on /local/ properties={...}
# 在不存在的目录上设置配额将会失败
$ bin/alluxio quota add --directory /another --quota-size 10GB
The specified quota path /another is not under any mount point! Existing mount points are:
[/s3/, /local/].
可以对现有挂载点下的任何目录设置配额定义。例如:
# /s3/ 是 Alluxio 命名空间中的已有挂载点
# 你可以对 /s3/ 下的目录设置配额定义
$ bin/alluxio quota add --directory /s3/data/ --quota-size 10GB
Successfully added quota definition for path /s3/data/ with size 10GB.
$ bin/alluxio quota list
Alluxio path Capacity Used State
/local 1024.00MB 900.10MB Available
/s3/data 10.00GB Calculating Available
# Suppose you have an existing parent and a child quota definition
$ bin/alluxio quota add --directory /s3/data/ --quota-size 10GB
$ bin/alluxio quota add --directory /s3/data/user1 --quota-size 5GB
# Adding the new child quota definition below will fail, as the sum of children would exceed the parent
$ bin/alluxio quota add --directory /s3/data/user2 --quota-size 6GB
Failed to add quota definition:
INVALID_ARGUMENT: Invalid quota definition:
Parent quota: (/s3/data : 10.00GB)
Current children quotas: [(/s3/data/user1 : 5.00GB)]
Adding this new quota will exceed the parent quota.
您可以在现有的子级配额定义之上添加父级配额定义。
$ bin/alluxio quota add --directory /s3/data/team1 --quota-size 5GB
Successfully added quota definition for path /s3/data/team1 with size 5GB.
$ bin/alluxio quota add --directory /s3/data/team2 --quota-size 4GB
Successfully added quota definition for path /s3/data/team2 with size 4GB.
# The parent quota must be larger than sum of all children quotas
$ bin/alluxio quota add --directory /s3/data/ --quota-size 10GB
Successfully added quota definition for path /s3/data/ with size 10GB.
您也可以在不相交的层级添加子级配额定义。换句话说,不是每个配额定义中的目录层级都需要有配额定义。
$ bin/alluxio quota add --directory /s3/data/shared/past-records --quota-size 512MB
Successfully added quota definition for path /s3/data/shared/past-records with size 512MB.
# The sum of all children quota definitions still does not exceed the parent quota definition
$ bin/alluxio quota list
Alluxio path Capacity Used State
/s3/data/ 10.00GB 464.00MB Available
/s3/data/shared/past-records 512.00MB 0B Available
/s3/data/team1 3.00GB 0B Available
/s3/data/team2 3.00GB 0B Available
$ bin/alluxio quota update --directory /local --quota-size 1MB
Loading the latest quota definitions from ETCD
Latest quota definitions loaded: {
/local=alluxioPath: "/local/"
quota: 11534336
ufsPath: "file:///Documents/Alluxio/underFSStorage/"
}
Reducing quota size for path /local from 11534336 to 1048576.
Failed to update quota: RESOURCE_EXHAUSTED: The target quota size 1048576 is smaller than the current usage 10486645. Please free up some space before reducing the quota size. Or use the --force option.
$ bin/alluxio quota list
Alluxio path Capacity Used State
/local 1024.00MB 0B Available
/s3/data 10.00GB 0B Available
/s3/data/user1 5.00GB 0B Available
/s3/data/user2 4.00GB 0B Available
Alluxio 还提供可持续向 coordinator 轮询最新配额使用情况的命令:
# Keeps running until interrupted by user by pressing ctrl+C
$ bin/alluxio quota list --interval 5s
Polling quota usage summary from the master every 5s
Alluxio path Capacity Used State
/local 1024.00MB 0B Available
/s3/data 10.00GB 0B Available
/s3/data/user1 5.00GB 0B Available
/s3/data/user2 4.00GB 0B Available
Alluxio path Capacity Used State
/local 1024.00MB 10.00MB Available
/s3/data 10.00GB 100.00MB Available
/s3/data/user1 5.00GB 100.00MB Available
/s3/data/user2 4.00GB 0B Available
...
# HELP alluxio_quota_size_capacity_bytes Capacity of the given quota scope as defined in the quota rules
# TYPE alluxio_quota_size_capacity_bytes gauge
alluxio_quota_size_capacity_bytes{dir="/s3"} 3.145728E8
alluxio_quota_size_capacity_bytes{dir="/s3/data"} 8.388608E7
alluxio_quota_size_capacity_bytes{dir="/local"} 1.048576E8
# HELP alluxio_quota_size_used_bytes Bytes used in the given quota scope
# TYPE alluxio_quota_size_used_bytes gauge
alluxio_quota_size_used_bytes{dir="/s3"} 3.145728E8
alluxio_quota_size_used_bytes{dir="/s3/data"} 0.0
alluxio_quota_size_used_bytes{dir="/local"} 0.0