Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
89 lines (59 sloc) 1.72 KB

HBase For Ruby Made Easy

To use HBase with Apache Thrift, you might have to manually generate Ruby code from generic *.thrift files.

This gem tries to alleviate that slight annoyance by packaging everything you need to communicate with HBase.



Add to Gemfile and run bundle install:

gem 'hbase-rb'

Without Bundler

Install the gem:

gem install hbase-rb

Require it explicitly in your scripts:

require "rubygems"
require "hbase-rb"


The version of the gem matches the version of HBase the interface was generated against.

For instance, when using HBase 0.90.4:

gem 'hbase-rb', '0.90.4'


This library simply exposes the generated Ruby code from Thrift. Therefore it is not necessarily very idiomatic Ruby.

For example:

socket    ='localhost', 9090)

transport =

protocol  =
client    =

puts client.getTableNames

Writing Rows

# Assuming a table "mytable" and a column family "c"
client.mutateRow("mytable", "abc123", [ "c:foo", value: "bar")])

Reading Rows

# Assuming a table "mytable" and a column family "c"
results = client.getRow("mytable", "abc123")
if result = results.first
  result.columns.each do |key, cell|
    puts "#{key}: #{cell.value}"

API Reference

Something went wrong with that request. Please try again.