Friday, October 14, 2011

Hadoop Hbase, Test JAVA client and inspect the network flow

I just setup three VMS, with the following roles /HOME NameNode, HbaseMaster(Standby server), Region Server, Zookeeper /LA DateNode, HbaseMaster (Active One), Region Server, Zookeeper /NJ Zookeeper

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


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, Here is the Code. 


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.

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

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.

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.

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


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