zoukankan      html  css  js  c++  java
  • Hadoop回收站trash

    Hadoop回收站trash,默认是关闭的。
    习惯了window的同学,建议最好还是把它提前开开,否则误操作的时候,就欲哭无泪了

    1.修改conf/core-site.xml,增加

    <property> 
    <name>fs.trash.interval</name> 
    <value>1440</value> 
    <description>Number of minutes between trash checkpoints. 
    If zero, the trash feature is disabled. 
    </description> 
    </property>

    默认是0.单位分钟。这里我设置的是1天(60*24)
    删除数据rm后,会将数据move到当前文件夹下的.Trash目录

    2.测试
    1)新建目录input

    hadoop/bin/hadoop fs -mkdir input

    2)上传文件

    root@master:/data/soft# hadoop/bin/hadoop fs -copyFromLocal /data/soft/file0* input


    3)删除目录input

    [root@master data]# hadoop fs -rmr input 
    Moved to trash: hdfs://master:9000/user/root/input


    4)参看当前目录

    [root@master data]# hadoop fs -ls 
    Found 2 items 
    drwxr-xr-x - root supergroup 0 2011-02-12 22:17 /user/root/.Trash

    发现input删除,多了一个目录.Trash

    5)恢复刚刚删除的目录

    [root@master data]# hadoop fs -mv /user/root/.Trash/Current/user/root/input /user/root/input


    6)检查恢复的数据

    [root@master data]# hadoop fs -ls input 
    Found 2 items 
    -rw-r--r-- 3 root supergroup 22 2011-02-12 17:40 /user/root/input/file01 
    -rw-r--r-- 3 root supergroup 28 2011-02-12 17:40 /user/root/input/file02


    6)删除.Trash目录(清理垃圾)

    [root@master data]# hadoop fs -rmr .Trash 
    Deleted hdfs://master:9000/user/root/.Trash

    转自 http://running.iteye.com/blog/904536

  • 相关阅读:
    Powershell分支条件
    Powershell基础
    初识PowerShell
    设计模式--策略模式
    设计模式--简单工程模式
    StandardWrapper
    Tomcat的安全性
    算法效率 简单的增长率 参照

    排序算法之 归并排序
  • 原文地址:https://www.cnblogs.com/ggjucheng/p/2454683.html
Copyright © 2011-2022 走看看