zoukankan      html  css  js  c++  java
  • hdfs shell操作

    hdfs所有命令行均有$HADOOP_HOME/bin/hadoop脚本执行,不指定参数bin/hadoop会显示所有命令的描述,可通过hadoop fs -help查看命令帮助。

    hdfs命令执行样式为hadoop fs -shell

    一、文件上传与下载

    1、文件上传,将文件从linux本地上传至hdfs

    方法1:hadoop fs -put  linux文件 hdfs文件

    方法2:hadoop fs -copyFromLocal linux文件 hdfs文件

    [hadoop@localhost ~]$ hadoop fs -put /tmp/test1.txt /
    [hadoop@localhost ~]$ hadoop fs -copyFromLocal /tmp/test2.txt /tmp/test2test2.txt /

    上传的时候可以对文件重命名

    2、文件下载,将文件从hdfs下载到linux本地

    方法1:hadoop fs -get  hdfs文件 linux文件

    方法2:hadoop fs -copyToLocal  hdfs文件 linux文件

    [hadoop@localhost ~]$ hadoop fs -get /test1.txt /tmp/
    [hadoop@localhost ~]$ hadoop fs -copyToLocal /test2test2.txt /tmp/test2.txt

    下载的时候也可以对文件重命名

    二、目录操作

    创建目录:例如hadoop fs -mkdir /test

    三、文件操作

    查看文件列表:例如hadoop fs -ls /test/

    查看文件内容:例如hadoop fs -cat /test/a.txt

    删除文件:例如hadoop fs -rm /test/a.txt

  • 相关阅读:
    git之clone
    gulp之sass 监听文件,自动编译
    cat命令
    centos安装yum源
    centos下wget: command not found的解决方法
    centos安装
    为什么很多公司招聘前端开发要求有 Linux / Unix 下的开发经验?
    ASP.NET MVC HtmlHelper用法集锦
    Html.Listbox的用法(实例)
    JSON入门实例
  • 原文地址:https://www.cnblogs.com/Forever77/p/15689851.html
Copyright © 2011-2022 走看看