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线程每次运行的时候,