NAME

Net::Hadoop::WebHDFS - Client library for Hadoop WebHDFS and HttpFs

SYNOPSIS

use Net::Hadoop::WebHDFS;
my $client = Net::Hadoop::WebHDFS->new( host => 'hostname.local', port => 50070 );

my $statusArrayRef = $client->list('/');

my $contentData = $client->read('/data.txt');

$client->create('/foo/bar/data.bin', $bindata);

DESCRIPTION

This module supports WebHDFS v1 on Hadoop 1.x (and CDH4.0.0 or later), and HttpFs on Hadoop 2.x (and CDH4 or later). WebHDFS/HttpFs has two authentication methods: pseudo authentication and Kerberos, but this module supports pseudo authentication only.

METHODS

Net::Hadoop::WebHDFS class method and instance methods.

CLASS METHODS

Net::Hadoop::WebHDFS->new( %args ) :Net::Hadoop::WebHDFS

Creates and returns a new client instance with %args. If you are using HttpFs, set httpfs_mode = 1> and port = 14000>.

%args might be:

host :Str = "namenode.local"
port :Int = 50070
username :Str = "hadoop"
doas :Str = "hdfs"
httpfs_mode :Bool = 0/1

INSTANCE METHODS

$client->create($path, $body, %options) :Bool

Creates file on HDFS with $body data. If you want to create blank file, pass blank string.

%options might be:

overwrite :Str = "true" or "false"
blocksize :Int
replication :Int
permission :Str = "0600"
buffersize :Int

$client->append($path, $body, %options) :Bool

Append $body data to $path file.

%options might be:

buffersize :Int

$client->read($path, %options) :Str

Open file of $path and returns its content. Alias: open.

%options might be:

offset :Int
length :Int
buffersize :Int

$client->mkdir($path, [permission => '0644']) :Bool

Make directory $path on HDFS. Alias: mkdirs.

$client->rename($path, $dest) :Bool

Rename file or directory as $dest.

$client->delete($path, [recursive => 0/1]) :Bool

Delete file $path from HDFS. With optional recursive = 1>, files and directories are removed recursively (default false).

$client->stat($path) :HashRef

Get and returns file status object for $path. Alias: getfilestatus.

$client->list($path) :ArrayRef

Get list of files in directory $path, and returns these status objects arrayref. Alias: liststatus.

$client->content_summary($path) :HashRef

Get 'content summary' object and returns it. Alias: getcontentsummary.

$client->checksum($path) :HashRef

Get checksum information object for $path. Alias: getfilechecksum.

$client->homedir() :Str

Get accessing user's home directory path. Alias: gethomedirectory.

$client->chmod($path, $mode) :Bool

Set permission of $path as octal $mode. Alias: setpermission.

$client->chown($path, [owner => 'username', group => 'groupname']) :Bool

Set owner or group of $path. One of owner/group must be specified. Alias: setowner.

$client->replication($path, $replnum) :Bool

Set replica number for $path. Alias: setreplication.

$client->touch($path, [modificationtime => $mtime, accesstime => $atime]) :Bool

Set mtime/atime of $path. Alias: settimes.

AUTHOR

TAGOMORI Satoshi <tagomoris {at} gmail.com>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.