zoukankan      html  css  js  c++  java
  • hdfs显示、查看、下载、上传、删除文件操作

    linux环境

    假设hdfs安装路径(例如是): /usr/hdp/hadoop/bin/hdfs

    1. -ls 列出当前目录下的文件、文件夹

    /usr/hdp/hadoop/bin/hdfs dfs -ls /apps/hive/warehouse/my_home

    2. 查看文件,例如hive表的内容

    /usr/hdp/hadoop/bin/hdfs dfs -text /apps/hive/warehouse/my_home/table_test/pa*
    /usr/hdp/hadoop/bin/hdfs dfs -cat /apps/hive/warehouse/my_home/table_test/pa*

    3. 下载文件到本地 /root目录下

    /usr/hdp/hadoop/bin/hdfs dfs -get hdfs://host:port/apps/hive/warehouse/my_home/my_text.txt /root

    4. 上传文件或文件夹到hdfs的某个目录

    /usr/hdp/hadoop/bin/hdfs dfs -put /root/my_test.txt ./
    /usr/hdp/hadoop/bin/hdfs dfs -put /root/my_dir ./

    5. 删除文件夹 my_dir

    /usr/hdp/hadoop/bin/hdfs dfs -rm -r /apps/spark/my_dir
  • 相关阅读:
    3.21上午
    3.17下午
    2017.4.14-morning
    2017.4.13-afternoon
    2017.4.13-morning
    2017.4.12-afternoon
    2017.4.12-morning
    2017.4.11-afternoon
    2017.4.11-morning
    2017.4.10-afternoon
  • 原文地址:https://www.cnblogs.com/qi-yuan-008/p/12210023.html
Copyright © 2011-2022 走看看