For your first question, see Section 9.3.1 on http://hbase.apache.org/book.html which says "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."
For your second question, the client connects to zookeeper to lookup the location of the regionserver holding "-ROOT-" table. Once this is determined, client reads the "-ROOT-" table to determine location of the ".META." table. The ".META." table contains each user table region entry. The client identifies the region holding the row key range it is interested in ... and then directly contacts that region server. So - zookeeper is used by a client only to lookup where the "-ROOT-" table is located ... and from that point on, it directly calls the region servers. --Suraj On Sun, Nov 4, 2012 at 9:47 PM, 김인태 <[email protected]> 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!
