hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leonid Fedotov <lfedo...@hortonworks.com>
Subject Re: how to work Htable connection
Date Mon, 05 Nov 2012 17:44:10 GMT
Hi!

As documentation stated:
HTable instances are not thread-safe. When creating HTable instances, it is advisable to use
the same HBaseConfiguration instance. This will ensure sharing of ZooKeeper and socket instances
to the RegionServers which is usually what you want.

Means that shared connection (method 1) is preferred.

As of your second question:
Client use zookeeper to find HBase master server, then consult with HBase master about region
server(s) location(s) and then connect to region server(s) directly.


Thank you!

Sincerely,
Leonid Fedotov


On Nov 4, 2012, at 9:47 PM, 김인태 wrote:

> Hi. I am novice of hbase.
> 
> I have some questions how to create htable,
> 
> I read some blogs and hbase definitive guide book.
> 
> First Question:
> 
> They said that we can create htable with following two methods.
> 
> First, sharing configuration
> Second, every new configuration instance
> 
> There are a example in http://hbase.apache.org/book/client.html
> 
> 1)
> 
> HBaseConfiguration conf = HBaseConfiguration.create();
> HTable table1 = new HTable(conf, "myTable");
> HTable table2 = new HTable(conf, "myTable");
> 
> 
> 2)
> 
> HBaseConfiguration conf1 = HBaseConfiguration.create();
> HTable table1 = new HTable(conf1, "myTable");
> HBaseConfiguration conf2 = HBaseConfiguration.create();
> HTable table2 = new HTable(conf2, "myTable");
> 
> 
> I can't understand difference of two implements. just instance count or
> connection?
> 
> In the first samlpe, is it 1 connection instance?
> is it 2 connection instance in another sample?
> 
> When I tested in 0.94.2, both created one zookeeper connection. so I have
> confused
> 
> 
> Second Question:
> When client get data in hbase, does a client connect only zookeeper or
> zookeeper and regionserver(not zookeeper)?
> 
> Thanks!


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message