HDFS设置配额管理

1、目录配额

[xiaoqiu@s150 /home/xiaoqiu/hadoop_tmp]$ hadoop fs -lsr /
lsr: DEPRECATED: Please use 'ls -R' instead.
drwxr-xr-x   - xiaoqiu supergroup          0 2017-12-29 15:50 /user
drwxr-xr-x   - xiaoqiu supergroup          0 2017-12-29 15:50 /user/xiaoqiu
drwxr-xr-x   - xiaoqiu supergroup          0 2017-12-29 15:50 /user/xiaoqiu/data
drwxr-xr-x   - xiaoqiu supergroup          0 2017-12-29 15:44 /usr
drwxr-xr-x   - xiaoqiu supergroup          0 2017-12-29 15:44 /usr/xiaoqiu
drwxr-xr-x   - xiaoqiu supergroup          0 2017-12-29 15:44 /usr/xiaoqiu/hadoop

[xiaoqiu@s150 /home/xiaoqiu/hadoop_tmp]$ hdfs dfsadmin -setQuota 1 data
[xiaoqiu@s150 /home/xiaoqiu/hadoop_tmp]$ hdfs dfs -mkdir -p data/a
mkdir: The NameSpace quota (directories and files) of directory /user/xiaoqiu/data is exceeded: quota=1 file count=2

[xiaoqiu@s150 /home/xiaoqiu/hadoop_tmp]$ hdfs dfsadmin -setQuota 3 data
[xiaoqiu@s150 /home/xiaoqiu/hadoop_tmp]$ hdfs dfs -mkdir -p data/a
[xiaoqiu@s150 /home/xiaoqiu/hadoop_tmp]$ hdfs dfs -mkdir -p data/a/b
[xiaoqiu@s150 /home/xiaoqiu/hadoop_tmp]$ hdfs dfs -mkdir -p data/a/b/c
mkdir: The NameSpace quota (directories and files) of directory /user/xiaoqiu/data is exceeded: quota=3 file count=4

2、设置空间配额

[xiaoqiu@s150 /home/xiaoqiu/hadoop_tmp]$ hdfs dfs -mkdir -p data2
[xiaoqiu@s150 /home/xiaoqiu/hadoop_tmp]$ hdfs dfsadmin -setSpaceQuota 5 data2
[xiaoqiu@s150 /home/xiaoqiu/hadoop_tmp]$ echo how > a.txt
[xiaoqiu@s150 /home/xiaoqiu/hadoop_tmp]$ hdfs dfs -put a.txt data2


3、清除配额

[xiaoqiu@s150 /home/xiaoqiu/hadoop_tmp]$ hdfs dfsadmin -clrQuota data
[xiaoqiu@s150 /home/xiaoqiu/hadoop_tmp]$ hdfs dfsadmin -clrQuota data2






























posted @ 2017-12-29 16:52  crr121  阅读(106)  评论(0编辑  收藏  举报