运行MapReduce+配置回收站

  1. 运行MapReduce
    1. 在本地文件系统中新建一个txt
      1. cd /home/data
      2. vim words
    2. 启动HDFS+yarn
      1. sbin/start-dfs.sh
      2. sbin/start-yarn.sh
    3. 将words放上HDFS
      1. bin/hdfs dfs -put /home/data/words /words
    4. 对words进行MapReduce处理将结果输出到/out
      1. bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.9.2.jar wordcount /words /out
    5. 对结果进行查看
      1. bin/hdfs dfs -cat /out/part-r-00000
  2. 配置回收站
    1. Hadoop的回收站trash功能默认是关闭的,所以需要在core-site.xml中手动开启。

    2. 在core-site.xml中添加

      1.  
                    fs.trash.interval 
                    10 

    3. 删除一个文件

      1. ​​​​​​​bin/hdfs dfs -rm -f /words

    4. 改变/user的文件权限

      1. bin/hdfs dfs -chmod -R /user

    5. 配置完成,可以在/user/root/.Trash/Current中找到删除的文件

你可能感兴趣的:(运行MapReduce+配置回收站)