Git Product home page Git Product logo

hdfsdownloader's Introduction

HDFS Downloader

This application loads a directory from Hadoop (HDFS) to a local directory using the Hadoop REST API, also known as WebHDFS.

Requirements

  • Go 1.17 (minimum)
  • Access to namenode HDFS
  • Docker (optional)

Usage

Set the following environment variables:

  • HDFS_NAMENODE: the address of your HDFS namenode (for example, namenode:8020)
  • HDFS_PATH: path to the directory on HDFS you want to load (e.g. /path/to/hdfs/directory)
  • LOCAL_PATH: path to the local directory where you want to load the HDFS directory (e.g. /path/to/local/directory)

Usage (in Docker)

Build the Docker image using the following command:

docker build -t hdfs-downloader .

Then start the Docker container with the following command, replacing the environment variables with your actual values:

docker run --rm -e HDFS_NAMENODE=namenode:8020 -e HDFS_PATH=/path/to/hdfs/directory -e LOCAL_PATH=/out -v $(pwd):/out hdfs-downloader

Under the hood the following

The downloadDir function reads a directory in HDFS, creates a corresponding local directory (using os.MkdirAll to create any necessary parent directories), and then downloads each file and recursively downloads each subdirectory.

As in the previous script, replace namenode:8020 with the actual namenode address and port, and replace /path/to/hdfs/directory and /path/to/local/directory with the actual HDFS and local directory paths.

Additionally, this script does not handle the Hadoop security model and does not download files in parallel.# HDFSDownloader

hdfsdownloader's People

Contributors

alexshnup avatar

Watchers

 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.