How to test the Hbase Thrift service
search cancel

How to test the Hbase Thrift service

book

Article ID: 294740

calendar_today

Updated On:

Products

Services Suite

Issue/Introduction

Hbase Thirft is a cross-platform, cross-language development framework. This article contains a sample application that enables you to test and learn about the Hbase Thrift Java API.

Environment


Resolution

1. Download the code.

$] git clone https://github.com/randomtask1155/HbaseThriftTest.git

2. Compile the code.

$] cd HbaseThriftTest 
$] mvn compile 
$] mvn package 

Test table creation

Attached jar file is for PHD 2.0.1.0 Hbase 0.96.0

Depending on what options used to start Hbase, Thrift will determine what Transport method is used.
 

Framed

  • service hbase-thrift start
  • hbase thrift start -f

Binary

  • hbase thrift start

Compact

  • hbase thrift start -c

Syntax help

Usage:
java -classpath HbaseThriftTest.jar:`hbase classpath` io.pivotal.support.HbaseThriftTest <host> <port> <protocol> <table name> <column family>

Examples

java -classpath HbaseThriftTest.jar:`hbase classpath` io.pivotal.support.HbaseThriftTest hdm1 9090 compact sample_demo_table demodata
java -classpath HbaseThriftTest.jar:`hbase classpath` io.pivotal.support.HbaseThriftTest hdm1 9090 framed sample_demo_table demodata
java -classpath HbaseThriftTest.jar:`hbase classpath` io.pivotal.support.HbaseThriftTest hdm1 9090 binary sample_demo_table demodata

Running the jar file

[gpadmin@hdw1 ~]$ java -classpath HbaseThriftTest-1.1.jar:`hbase classpath` io.pivotal.support.HbaseThriftTest hdw1 9090 compact NEWTABLE demodata
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/lib/gphd/zookeeper/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/lib/gphd/hadoop/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
#~ Dumping Existing tables
-- found: TestTable
-- found: sample_demo_table
-- found: sample_demo_table2
#~ Creating table: NEWTABLE


Additional Information

HbaseThriftTest-1.1 (There is no preview available with this file; download and use it as required.)