Re: Run hbase shell script from java

2016-01-14 Thread Serega Sheypak
Hi, guys,thanks for reply.
I have a table named 'MY_TABLE'
I have two ways to create it:
1. using habse shell script: create table 'MY_TABLE' bla-bla-bla... I use
hbase shell script for production deployment purposes. It's easier to run,
maintain and do migrations (change some table attributes)
2. I have the same table DDL written using Java API, like here:
https://gist.github.com/dvimont/a7791f61c4ba788fd827 I use java api to
create tables before running my integration tests.

So I have to support two table DDL and sync them in habse shell script and
in Java API. I want to get rid of Java api.


2016-01-14 1:52 GMT+01:00 Daniel Vimont :

> Serega,
>
> I agree with Anil Gupta that direct use of the Java API should prove much
> more straightforward than indirectly invoking the HBase shell from within
> Java.
>
> If you need a brief "gist" example of how to use the Java API for HBase,
> you can find one here:
> https://gist.github.com/dvimont/a7791f61c4ba788fd827
>
> Cheers,
>
> Dan Vimont
>
> On Thu, Jan 14, 2016 at 9:12 AM, anil gupta  wrote:
>
> > Hey Serega,
> >
> > Have you tried using Java API of HBase to create table? IMO, invoking a
> > shell script from java program to create a table might not be the most
> > elegant way.
> > Have a look at
> >
> >
> https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/client/HBaseAdmin.html
> >
> > HTH,
> > Anil Gupta
> >
> > On Wed, Jan 13, 2016 at 1:30 PM, Serega Sheypak <
> serega.shey...@gmail.com>
> > wrote:
> >
> > > Hi, is there any easy way/example/howto to run 'create table ' shell
> > script
> > > from java?
> > > Usecase: I'm tired to write table DDL in shell script and in Java for
> > > integration testing. I want to run shell script table DDL from java.
> > > Thanks!
> > >
> >
> >
> >
> > --
> > Thanks & Regards,
> > Anil Gupta
> >
>


Re: Java API vs Hbase Thrift

2016-01-14 Thread Vladimir Rodionov
>> I have to access hbase using Java API will it be fast like thrift.

Bear in mind that when you use Thrift Gateway/Thrift API you access HBase
RegionServer through the single gateway server,
when you use Java API - you access Region Server directly.
Java API is much more scalable.

-Vlad

On Tue, Jan 12, 2016 at 7:36 AM, Anil Gupta  wrote:

> Java api should be same or better in performance as compared to Thrift api.
> With Thrift api there is an extra hop. So, most of the time java api would
> be better for performance.
>
> Sent from my iPhone
>
> > On Jan 12, 2016, at 4:29 AM, Rajeshkumar J 
> wrote:
> >
> > Hi,
> >
> >  I am currently accessing records via Hbase thrift server and it is fast.
> > If I have to access hbase using Java API will it be fast like thrift.
> >
> > Thanks
>