zoukankan      html  css  js  c++  java
  • HDFS命令

    1.查看客户端默认的Block大小

    hdfs getconf -confKey dfs.blocksize
    

    2.查看指定文件的Block大小

    hadoop fs -stat %o hdfs://localhost/user/harsh/file.txt
    

    3.把本地文件上传到服务器

    hadoop dfs -copyFromLocal <localsrc> URI
    hadoop fs -put [-f] [-p] [-l] [-d] [ - | <localsrc1> .. ] <dst>

    hadoop fs -put test /user/hadoop/test

    4.拷贝

    hadoop fs -cp [src] [dst]

    移动

    hadoop fs -mv [src] [dst] 

    5.把文件复制到本地

    hadoop fs -copyToLocal [-ignorecrc] [-crc] URI <localdst>
    hadoop fs -get [dst] [localdst]

    6.删除

    hadoop fs -rm
    hadoop fs -rm -R

    7.查看文件内容

    hadoop fs -cat filename
    hadoop fs -text filename

    8查看大小

    hadoop fs -du  -h <path>  

    9.合并下载多个文件(源头可以是目录,可以是指定的多个文件)

    hadoop fs -getmerge  /src ./output.txt
    hadoop fs -getmerge  /src/file1.txt /src/file2.txt ./output.txt

    10.文件检测

    hadoop fs -test -[defsz]  URI
    • -d: 如果路径是目录, return 0.
    • -e: 如果路径存在, return 0.
    • -f: 如果路径是文件, return 0.
    • -s: 如果路径不为空, return 0.
    • -w: 如果路径存在且有写权限, return 0.
    • -r: 如果路径存在且有读权限, return 0.
    • -z: 如果文件长度为零, return 0.

      

  • 相关阅读:
    mysql优化思路
    mysql列类型选择
    mysql 多列索引的生效规则
    Myisam索引和Innodb索引的区别
    mysql创建远程用户并授权
    mysql 索引长度和区分度
    php 内存共享shmop源码阅读
    短链接系统的算法原理
    PHP die与exit的区别
    MySQL建立外键(Foreign Key)
  • 原文地址:https://www.cnblogs.com/vdvvdd/p/9394543.html
Copyright © 2011-2022 走看看