You can prevent inadvertent deletion of important data from your HDFS cluster by
marking specific directories as protected. Marking a directory as protected
prevents its recursive deletion. However, this does not protect against graceful deletion of
files under the directory. You can delete the files by moving them to trash.
-
Go to the HDFS service.
-
Click the Configuration tab.
-
Set the Cluster-wide Advanced Configuration Snippet (Safety Valve)
for core-site.xml property as specified:
- Name:
fs.protected.directories
- Value: Specify a comma-separated list of the
directories that you want to mark as protected; for
example,
/user
, /data
, and so on.
-
Enter a Reason for Change, and then click
Save Changes to save the property changes.
-
Restart the cluster.