Check the file number of blocks command: hdfs fsck / -blocks
HDFS waste recycling, the default is 0, in minutes, the experiment is set to 1 days or 1440.
core-site.xml
<property>
<name>fs.trash.interval</name>
<value>1440</value>
</property>
On-line time to transfer large waste recycling to 7 days
The timing of execution of the script, shell develop delete the Recycle Bin
Cleaning up litter and trash:
hdfs dfs -ls /user/root/.Trash
hdfs dfs -rm -r /user/root/.Trash/190815070000
Data recovery:
experiment:
# Delete a folder
[root@oldboy-node101 ~]# hdfs dfs -rm -r /tmp/logs/root/logs/logs
19/06/17 20:29:08 INFO fs.TrashPolicyDefault: Namenode trash configuration: Deletion interval = 1440 minutes, Emptier interval = 0 minutes.
Moved: 'hdfs://oldboy-node101:9000/tmp/logs/root/logs/logs' to trash at: hdfs://oldboy-node101:9000/user/root/.Trash/Current
# Check whether they have in the Recycle Bin
[root@oldboy-node101 ~]# hdfs dfs -ls /user/root/.Trash/Current/tmp/logs/root/logs
Found 1 items
drwx------ - root supergroup 0 2019-06-17 19:34 /user/root/.Trash/Current/tmp/logs/root/logs/logs
# Recover, you can move back to the original position
hdfs dfs -mv /user/root/.Trash/Current/tmp/logs/root/logs /tmp/logs/root/logs
# Manually deleted permanently
hdfs dfs -rm -r /user/root/.Trash/Current/tmp/logs/root/logs/logs