【HDFS】HDFS中的Trash功能

171 篇文章 147 订阅 ¥29.90 ¥99.00
本文介绍了HDFS中的Trash功能,类似操作系统中的回收站,提供数据误删后的恢复可能。Trash功能默认关闭,需要通过配置`fs.trash.interval`和`fs.trash.checkpoint.interval`来启用。Trash目录包含`current`和以时间戳命名的checkpoint目录,每隔一定时间进行checkpoint并清理过期的checkpoint。源码分析显示,只有Active NameNode能执行Trash功能,通过`startTrashEmptier`启动清理线程,`Emptier`类的`run`方法实现定期清理。
摘要由CSDN通过智能技术生成

HDFS的trash有点类似于linux和windows中的垃圾箱,用户删除数据后并不会直接删掉,而是先放入垃圾箱中,如果用户误删除了数据,trash就给用户一个可以反悔的机会。

hdfs默认是不开启trash功能的,如果要开启trash功能,需要在core-site.xml中配置以下两个相关参数:

fs.trash.interval (默认值是0)
fs.trash.checkpoint.interval (默认值是0)

fs.trash.interval 配置项的意义如下:

多少分钟后删除checkpoint文件。如果是0,那么trash功能被禁用。

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.checkpoint.interval配置项的意义如下:

两次trash checkpoint之间的分钟间隔,这个值应该被设置为小于等于 fs.trash.interval的值。如果配置项为0,那么这个配置项的值会被设置为fs.trash.interval的值。 checkpointer线程每次运行的时候,

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

叹了口丶气

觉得有收获就支持一下吧~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值