Databases Reference
In-Depth Information
You can change permission settings and ownership using bin/hadoop fs -chmod ,
-chown , and -chgrp . They behave similarly to Unix commands of the same name.
8.4
Managing quotas
By default HDFS doesn't have any quota
to limit how much you can put in a direc-
tory. You can enable and specify name quotas on specific directories, which place a
hard limit on the number of file and directory names under that directory. The main
use case for name quotas is to prevent users from generating too many small files
and overwork the NameNode. The following commands are for setting and clearing
name quotas:
bin/hadoop dfsadmin -setQuota < N > directory [... directory ]
bin/hadoop dfsadmin -clrQuota directory [... directory ]
Starting with version 0.19, HDFS also supports space quotas on a per directory basis.
This helps manage the amount of storage a user or application can take up.
bin/hadoop dfsadmin -setSpaceQuota < N > directory [... directory ]
bin/hadoop dfsadmin -clrSpaceQuota directory [... directory ]
The setSpaceQuota command
takes an argument for the number of bytes as each
directory's quota. The argument can have a suffix to represent unit. For example,
20g will mean 20 gigabytes, and 5t would mean 5 terabytes. All replicas count towards
the quota.
To get the quotas associated with a directory as well as a count of the number of
names and bytes it uses, use the HDFS shell command count with the -q option.
bin/hadoop fs -count -q directory [... directory ]
8.5
Enabling trash
In addition to file permissions, an additional safeguard against accidental deletion of
files in HDFS is the trash feature. By default this feature is disabled. When this feature
is enabled, the command line utilities for deleting files don't delete files immediately.
Instead, they move the files temporarily to a .Trash/ folder
under the user's working
directory. The files are not permanently removed until after a user-configurable time
delay. As long as a file is still in the .Trash/ folder, you can restore it by moving it back
to its original location.
To enable the trash feature and set the time delay for the trash removal, set the
fs.trash.interval property in core-site.xml to the delay (in minutes). For example,
if you want users to have 24 hours (1,440 minutes) to restore a deleted file, you should
have in core-site.xml
<property>
<name>fs.trash.interval</name>
<value>1440</value>
</property>
Setting the value to 0 will disable the trash feature.
 
Search WWH ::




Custom Search