Giter Club home page Giter Club logo

node-hdfs's Introduction

node-hdfs

This provides a JNI-implemented HDFS client allowing node.js applications to natively interoperate with the Hadoop FileSystem.

Example Use

There's a run script that will build + run the demo/demo.js sample.

var HDFS = require('node-hdfs');
var client = new HDFS({host:"default", port:0});

client.list("/tmp/path", function(err, files) {
  console.log(files);
});

Compiling

At the moment it's still a little tricky. At the least you'll need to make sure libhdfs is built and installed in a path accessible by ldconfig (i.e. /usr/local/lib).

Ubuntu

I (Paul) have had success with Cloudera's CDH distribution. Please see their instructions for installing from packages.

Mac OSX

cd [hadoop_uncompressed_src_path]/src/c++/libhdfs
chmod +x ./configure
./configure

To build libhdfs in Mac OSX a few changes need to be done in the generated 'Makefile' by './configure':

Edit Makefile and search for a line that starts with 'CFLAGS = -g O2'

  • Remove the parameter "-m"
  • Add parameter "-framework JavaVM"

Search for a line that starts with 'DEFS = -DPACKAGE_NAME=\"libhdfs\" -DPACKAGE_TARNAME=\"libhdfs\"'

  • Remove the parameter "-Dsize_t=unsigned\ int"

Comment or remove include in 'hdfsJniHelper.c' :

Search for '#include <error.h>' and remove (or comment it out).

Then build

make
chmod +x ./install-sh
make install

Copy the libraries to a folder accessible to the compiler or add it to the env with dyld (man dyld for more information).

cd [hadoop_uncompressed_src_path]/src/c++/install/lib
cp libhdfs* /usr/local/lib

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.