Pivotal Knowledge Base

Follow

How to Test Hbase Thrift service

Environment

  • java 1.7
  • PHD 2.0.1.0
  • Hbase 0.96

Purpose

Hbase Thirft 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.  

Download the code

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

Compile

$] 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 in use

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

 

 

Comments

Powered by Zendesk