温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

怎么查看CDH5是否开启Trash

发布时间:2022-01-17 16:47:47 来源:亿速云 阅读:111 作者:iii 栏目:服务器

本文小编为大家详细介绍“怎么查看CDH5是否开启Trash”,内容详细,步骤清晰,细节处理妥当,希望这篇“怎么查看CDH5是否开启Trash”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。

查看CDH 的hdfs的配置,是否开启trash 及 保留时间:

怎么查看CDH5是否开启Trash

测试:

1.创建test.txt

[root@sht-sgmhadoopnn-01 ~]# vi /tmp/test.txt

2.创建文件夹

  1. [root@sht-sgmhadoopnn-01 ~]# hadoop fs -mkdir /testdir

  2. You have new mail in /var/spool/mail/root

  3. [root@sht-sgmhadoopnn-01 ~]# hadoop fs -ls /

  4. Found 4 items

  5. drwxr-xr-x - hdfs supergroup 0 2016-02-04 00:38 /system

  6. drwxr-xr-x - root supergroup 0 2016-02-19 08:17 /testdir

  7. drwxrwxrwt - hdfs supergroup 0 2016-02-10 16:04 /tmp

  8. drwxr-xr-x - hdfs supergroup 0 2016-02-10 16:02 /user

3.put 文件到hadoop

  1. [root@sht-sgmhadoopnn-01 ~]# hadoop fs -put /tmp/test.txt /testdir

  2. [root@sht-sgmhadoopnn-01 ~]# hadoop fs -ls /testdir

  3. Found 1 items

  4. -rw-r--r-- 3 root supergroup 10 2016-02-19 08:18 /testdir/test.txt

  5. [root@sht-sgmhadoopnn-01 ~]# hadoop fs -cat /testdir/test.txt


  6. You have mail in /var/spool/mail/root

4.删除文件夹testdir

  1. [root@sht-sgmhadoopnn-01 ~]# hadoop fs -rm -r /testdir

  2. 16/02/19 08:27:05 INFO fs.TrashPolicyDefault: Namenode trash configuration: Deletion interval = 1440 minutes, Emptier interval = 0 minutes.

  3. Moved: 'hdfs://sgm-nameservice/testdir' to trash at: hdfs://sgm-nameservice/user/root/.Trash/Current

  4. [root@sht-sgmhadoopnn-01 ~]# hadoop fs -ls /

  5. Found 3 items

  6. drwxr-xr-x - hdfs supergroup 0 2016-02-04 00:38 /system

  7. drwxrwxrwt - hdfs supergroup 0 2016-02-10 16:04 /tmp

  8. drwxr-xr-x - hdfs supergroup 0 2016-02-10 16:02 /user

  9. You have mail in /var/spool/mail/root

5.查看回收站

  1. [root@sht-sgmhadoopnn-01 ~]# hadoop fs -ls /user/root/.Trash/Current

  2. Found 1 items

  3. drwxr-xr-x - root supergroup 0 2016-02-19 08:18 /user/root/.Trash/Current/testdir

6.恢复文件夹

  1. [root@sht-sgmhadoopnn-01 ~]# hadoop fs -mv /user/root/.Trash/Current/testdir /

  2. [root@sht-sgmhadoopnn-01 ~]# hadoop fs -ls /

  3. Found 4 items

  4. drwxr-xr-x - hdfs supergroup 0 2016-02-04 00:38 /system

  5. drwxr-xr-x - root supergroup 0 2016-02-19 08:17 /testdir

  6. drwxrwxrwt - hdfs supergroup 0 2016-02-10 16:04 /tmp

  7. drwxr-xr-x - hdfs supergroup 0 2016-02-10 16:02 /user

  8. [root@sht-sgmhadoopnn-01 ~]# hadoop fs -cat /testdir/test.txt

读到这里,这篇“怎么查看CDH5是否开启Trash”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI