HDFS根目录配额无法清除:设置成功但clrQuota命令报错
Hey there, let's break down why you're hitting that "Cannot clear namespace quota on root" error and fix it.
问题根源
You used the command hdfs dfsadmin -clrQuota /**, but here's the catch: the /** is a shell wildcard that gets expanded to all subdirectories and files under the root directory instead of targeting the root (/) itself. This means your command was trying to clear quotas for every child node under /, not the root directory's own quota. HDFS detects the root's quota is still in place but isn't being targeted directly, hence the error.
正确解决步骤
Check the root directory's quota status first
Run this command to confirm the current quota setting for/:hdfs dfs -count -q /Look at the
QUOTAcolumn in the output—it should show the value3you set earlier.Clear the root directory's quota directly
Use the exact root path (/) instead of wildcards to target the root directory itself:hdfs dfsadmin -clrQuota /This command will directly remove the namespace quota you applied to
/.Verify the fix
Re-run the quota check command to make sure the quota is gone:hdfs dfs -count -q /The
QUOTAcolumn should now shownone, confirming the quota has been successfully cleared.
Quick Notes
- Avoid using wildcards like
/**when operating on the root directory—shell wildcard expansion messes with HDFS's target path resolution. - Make sure you're running these commands as a superuser (like the
hdfsuser) since modifying root-level quotas requires elevated permissions.
内容的提问来源于stack exchange,提问作者CrazyMinion

