PolarDB Agent LakeBase supports directory-level quota management. You can set hard limits on the storage capacity and file count for a specified directory. When a directory's usage reaches the quota limit, write operations to that directory are denied. This ensures resource isolation and quality of service (QoS) in multi-tenant environments. PolarDB Agent LakeBase provides two methods to manage quotas: OpenAPI and the lakebase-client command-line tool.
Prerequisites
-
You have obtained the MetaURL from the Basic Information page of your PolarDB Agent LakeBase instance.
Manage quotas using API
-
Set a directory quota: Apply Quota Rule to Directory
-
Check quota consistency: Check Quota Consistency
-
Delete a directory quota: Delete Polarlakebase File Quota
Manage quotas using the CLI
Prerequisites
Download the lakebase-client tool.
curl -o lakebase-client https://lakebase-client.oss-cn-beijing.aliyuncs.com/lakebase-client-latest
chmod +x lakebase-client
Set a quota
Set a hard limit on the storage capacity and file count for a specified directory.
lakebase-client quota set $META_URL --path /agents/workspace-001 --capacity 10 --inodes 100000
Quota commands access the metadata service directly. The path specified in the command must be the absolute path in LakeBase, not the local mount path.
Parameters
|
Parameter |
Description |
|
|
The absolute path of the directory. |
|
|
The hard limit for storage capacity, in GiB. The default value is 0, which indicates no limit. |
|
|
The hard limit for the file count. The default value is 0, which indicates no limit. |
|
|
Performs a precise, recursive traversal of all files to calculate total usage. By default, the system calculates usage quickly by summing the cached statistics for each directory. |
Query a quota
Displays the quota information for a specified directory, including quota limits and current usage.
lakebase-client quota get $META_URL --path /agents/workspace-001
List all quotas
Displays a list of all directories on the instance that have quotas configured.
lakebase-client quota list $META_URL
Delete a quota
Removes the quota configuration for a specified directory. After deletion, the directory is no longer subject to capacity and file count limits.
lakebase-client quota delete $META_URL --path /agents/workspace-001
Check quota consistency
Verifies whether the actual usage for a quota matches the recorded value, and optionally repairs any inconsistent data.
lakebase-client quota check $META_URL --path /agents/workspace-001
Parameters
|
Parameter |
Description |
|
|
The absolute path of the directory to check. |
|
|
Repairs inconsistent quota data. |
Considerations
-
Quotas are hard limits. When a directory's usage reaches the limit, subsequent write operations are blocked and an
EDQUOT (Disk quota exceeded)error is returned. -
You can set limits on both storage capacity
Capacity/--capacityand file countInodes/--inodes. A value of0for either parameter indicates no limit. If you want to limit only one dimension, set the other to0. -
The quota path must be an existing directory, so we recommend creating the directory before setting the quota.
-
A subdirectory's usage counts toward the quotas of all its parent directories that also have quotas configured. For example, if both
/aand/a/bhave quotas, writing data to/a/bconsumes the quotas of both directories. -
Deleting a quota only removes the limits on capacity and file count. It does not delete any data in the directory.
-
When you use the
--strictparameter to set a quota on a directory with a large number of files for the first time, the system needs to scan and calculate the directory's usage. This operation can be time-consuming. We strongly recommend that you perform this action during off-peak hours. -
We recommend periodically running the OpenAPI-CheckPolarFsQuotaConsistency operation or the quota check command to ensure quota statistics are accurate.