Coder Social home page Coder Social logo

ruby-hdfs-cdh4's Introduction

ruby libhdfs client

requirements

  • ruby (1.9.2 <=)
  • java (1.6 <=)
  • libhdfs (2.x)

installation

gem install ruby-hdfs-cdh4

this gem provides defaults for installation on machines using cdh4 and the hadoop-libhdfs cloudera package, but the following environment variables are available for configuration.

  • HADOOP_ENV
  • JAVA_HOME
  • JAVA_LIB

for example, on Mac OS X you will need to do:

JAVA_HOME=`/usr/libexec/java_home -v 1.6` \
JAVA_LIB=`/usr/libexec/java_home -v 1.6`/../Libraries/libjvm.dylib \
gem install ruby-hdfs-cdh4

usage

to setup your classpath on cdh4 machines require hdfs/classpath, or see classpath.rb as an example.

require 'hdfs/classpath'

# connecting to HDFS
dfs = Hadoop::DFS::FileSystem.new host: 'namenode.domain.tld', port: 8020

dfs.list_directory('/').select(&:is_directory?).first.name
 => 'hdfs://namenode.domain.tld:8020/hbase'

# copying a file from your local file system to hdfs
local = Hadoop::DFS::FileSystem.new local: true
local.copy '/tmp/local_file', '/tmp/remote_file', hdfs
 => true

# copying and moving files from one HDFS to another

another_dfs = Hadoop::DFS::FileSystem.new host: 'namenode2.domain.tld', port: 8020
dfs.copy '/tmp/remote_file', '/tmp/remote_file', another_dfs
 => true

another_dfs.move '/tmp/remote_file', '/tmp/another_remote_file', dfs
 => true

dfs.delete '/tmp/another_remote_file'
 => true

# HDFS file mode, owner, group, and replication modifications

dfs.chmod '/tmp/remote_file', 755
 => true

dfs.chown '/tmp/remote_file', 'hdfs'
 => true

dfs.chgrp '/tmp/remote_file', 'hdfs'
 => true

dfs.set_replication '/tmp/remote_file', 2
 => true

ruby-hdfs-cdh4's People

Contributors

dallasmarlow avatar ssalevan avatar komapa avatar

Stargazers

Phil Smith avatar

Watchers

David Joslin avatar Dr. Pete Meyers avatar Anish Kumar avatar Jesse Brown avatar Jason Younker avatar  avatar  avatar David Overcash avatar Andreas Heim avatar Miranda avatar Shelly Matsudaira avatar Arunabha Ghosh avatar Koos Kleven avatar Brandon Forehand avatar Aqui Griffin avatar  avatar James Cloos avatar Bryan Stenson avatar Tyler Murray avatar  avatar James Dominguez avatar  avatar Manish avatar  avatar  avatar Don avatar  avatar Peter Li avatar Shawn Edwards avatar Sambit  avatar Gabriel Cain avatar  avatar Mike O'Leary avatar Kelsey Foley avatar  avatar  avatar KSHITIJ GAUTAM avatar Jon White avatar  avatar Sam Sullivan avatar  avatar  avatar  avatar  avatar MarkG avatar  avatar Ahmed Radwan avatar  avatar Chell avatar Jowell Villasin avatar  avatar  avatar  avatar  avatar Chris Airola avatar  avatar Justis avatar Nicolas Menescardi avatar Greg Burton avatar Omar Tsai avatar  avatar vadim avatar  avatar Trish G. avatar  avatar  avatar  avatar  avatar Gary Webb avatar Chiaryn Miranda avatar  avatar  avatar  avatar Namrata Deshpande avatar  avatar  avatar  avatar Tammy Bailey avatar  avatar  avatar  avatar Scott E avatar Matt McDonnell avatar Jamie Alberico avatar Charles Robison avatar Esha Ray avatar Carlos Westman avatar  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.