您的位置:首页 > 大数据 > Hadoop

大数据开发之Hadoop篇----hdfs垃圾回收机制配置

2018-10-12 14:42 579 查看

其实要启动hdfs上的垃圾回收机制只需要配置两个参数就可以了,也是在core-site.xml上配置就好了,我们先去官网看下这个两参数的解释。

官网的解释是:Number of minutes after which the checkpoint gets deleted. If zero, the trash feature is disabled. This option may be configured both on the server and the client. If trash is disabled server side then the client side configuration is checked. If trash is enabled on the server side then the value configured on the server is used and the client configuration value is ignored.

当fs.trash.interval设置为0的时候是禁用了垃圾回收机制的功能的,而其设置是按分钟来的,现在我们设置为1440,一天的时间,而生产上我们一般是设置成7天或者14天这样子的。

而第二个参数fs.trash.checkpoint.interval的意思是:Number of minutes between trash checkpoints. Should be smaller or equal to fs.trash.interval. If zero, the value is set to the value of fs.trash.interval. Every time the checkpointer runs it creates a new checkpoint out of current and removes checkpoints created more than fs.trash.interval minutes ago.

意味这两个检查点之间的分钟数,一般是要少于或者等于fs.trash.interval的,如果设置为0的话就等同与fs.trash.interval,所以生产上我们就直接设置为0。

我现在试下删除一个文件

尤其最后一句话,删除只是把文件移动到了一个路径,这个路径在:

hdfs://hadoop001:9000/user/hadoop/.Trash/Current/user/hadoop/LICENSE.txt。这个就是回收站的路径了,想恢复你直接mv回去就行了。

阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: