GithubHelp home page GithubHelp logo

wanghangyu817 / hdfsutils Goto Github PK

View Code? Open in Web Editor NEW

This project forked from qqhuxuhui/hdfsutils

0.0 0.0 0.0 45 KB

hdfs文件治理工具,文件批量解压、压缩、小文件合并

Java 100.00%

hdfsutils's Introduction

HDFSUtils

utils for hdfs

介绍

操作hdfs文件的工具集合,包括文件解压缩、碎文件合并等

运行环境

  • jdk1.7+
  • hdfs2.x

编译打包

mvn clean 
mvn assembly:assembly

使用说明

1. 批量解压缩文件(Gzip格式)

java -cp HDFSUtils-1.0-jar-with-dependencies.jar hdfs.compress.CompressFile <fsUri> <path> <type> <threads> <isAll>

或者使用hadoop命令运行
hadoop jar HDFSUtils-1.0-jar-with-dependencies.jar hdfs.compress.CompressFile <fsUri> <path> <type> <threads> <isAll>
参数说明
  • <fsUri>:hdfs地址,例如hdfs://xxx.xxx.xxx.xxx:8020,如果使用hadoop命令,这里的地址可以使用namenode的servicename
  • <path>:需要合并的目录路径,例如解压缩hdfs上面位于/data/a目录下的文件,参数就为/data/a或者/data/a/或者/data/a/*都可以
  • <type>:
    • compress:压缩
    • uncompress:解压
  • <threads>:压缩文件的并发度,压缩文件占用服务器带宽资源较为明显,可以适当调小并发度。
  • <isAll>,缺省值为false:
    • false:只解/压缩当前目录下的文件,不包括目录下的子目录
    • true:解/压缩当前目录以及当前目录子目录下的所有文件

2. 合并指定目录下的小文件

java -cp HDFSUtils-1.0-jar-with-dependencies.jar hdfs.merge.MergeSmallFile <fsUri> <path> <isGz>

或者使用hadoop命令运行
hadoop jar HDFSUtils-1.0-jar-with-dependencies.jar hdfs.merge.MergeSmallFile <fsUri> <path> <isGz>
参数说明
  • <fsUri>:hdfs地址,例如hdfs://xxx.xxx.xxx.xxx:8020,如果使用hadoop命令,这里的地址可以使用namenode的servicename
  • <path>:需要合并的目录路径,会遍历目录下的所有子目录。
  • <isGz>:是否合并压缩过的.gz文件,注意,这里以文件名.gz来区分是否是压缩过的文件
    • false:默认值,合并未经压缩的普通文件
    • true:只合并.gz的压缩过的文件

hdfsutils's People

Contributors

qqhuxuhui avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.