Friday, October 14, 2011

Hadoop Hbase, Test JAVA client and inspect the network flow

I just setup three VMS, with the following roles

192.168.209.130 /HOME NameNode, HbaseMaster(Standby server), Region Server, Zookeeper
192.168.209.132 /LA DateNode, HbaseMaster (Active One), Region Server, Zookeeper
192.168.209.133 /NJ Zookeeper

then I create one basic table, called ‘customer’ with Info as the only one column family.

image

then on the client machine which is win 7, I write a simple HBASE client to push some data to the HBASE. client runs on 192.168.209.1, Here is the Code. 

image 

on the client side, you need reference the HBASE jars , and put the conf folder into the classpath. in the client hbase-site.xml, just point to the zookeeper instances. Here I put three ZK quorums.
image

Then run the program, after done. you can tell from the hbase  shell, 5 records are there.
image

from the client, you can tell from the console log. it will first talk to zookeeper, to get which master is active. then  query the root region, then the meta region information.
image

after that, it will write data to the corresponding regions server directly.

here is the network flow layout.
First, setup TCP connection with Zookeeper, to locate the master server.  2181 is the zookeeper Listening Port.
image

Then talk to Root region server which is LA to get the region allocation.
image
once it has those information, it will cached in memory. then put the data to that regions server directly.

image

that’s all the client conversation. (client , zookeeper, region server.)

The general communication flow is that a new client contacts the ZooKeeper ensemble
(a separate cluster of ZooKeeper nodes) first when trying to access a particular row. It
does so by retrieving the server name (i.e., hostname) that hosts the -ROOT- region from
ZooKeeper. With this information it can query that region server to get the server name
that hosts the .META. table region containing the row key in question. Both of these
details are cached and only looked up once. Lastly, it can query the reported .META.
server and retrieve the server name that has the region containing the row key the client
is looking for.

No comments:

 
Locations of visitors to this page