HBase::JSONRest::Scanner - Simple client for HBase stateless REST scanners
A simple scanner:
use HBase::JSONRest; my $hbase = HBase::JSONRest->new(host => 'my-rest-host'); my $table = 'name of table to scan'; my $prefix = 'key prefix to scan'; my $batch_size = 100; # rows per one batch my $scanner = HBase::JSONRest::Scanner->new({ hbase => $hbase, table => $table, prefix => $prefix, atatime => $batch_size, }); my $rows; while ($rows = $scanner->get_next_batch()) { print STDERR "got " . @$rows . " rows in " . sprintf("%.3f", $scanner->{last_batch_time}) . " seconds\n\n"; print STDERR "first key in batch ==> " . $rows->[0]->{row} . "\n"; print STDERR "last key in batch ==> " . $rows->[-1]->{row} . "\n"; }
Simple client for HBase stateless REST scanners.
Constructor. Cretes an HBase stateless REST scanner object.
my $scanner = HBase::JSONRest::Scanner->new({ hbase => $hbase, table => $table, prefix => $prefix, atatime => $batch_size, });
Gets the next batch of records
while ($rows = $scanner->get_next_batch()) { ... }
To install HBase::JSONRest, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HBase::JSONRest
CPAN shell
perl -MCPAN -e shell install HBase::JSONRest
For more information on module installation, please visit the detailed CPAN module installation guide.