here is a quick tutorial to setup hbase instance and hook up with a basic coprocessor.
Download the tar file and unzip it from http://mirror.tcpdiag.net/apache/hbase/hbase-0.94.11/
Change the Hbase-site.xml, point the hbase.rootdir to the local folder, by default Hbase will load the default one embedded in the hbase-x.jar, and default setting is local temp folder,
change it to a folder you fell comfortable,
also change the hbase.temp.dir to a well know folder, you can see all the underlying folder it used,
My final change,
![image image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfr01hVOBrkGEPcpE0eC8SydymtYbQ8EkJg87Srr60NZ4m_YxfL8w8joTv1HJvKpOyw8v44C_704ZPeHr-t6VWTt-kG0p6TT1_pr43cwjTJHTTJruVt0XxE32oD996NSeI2FWg5BejWVw/?imgmax=800)
then you can start the hbase server ./bin/start-hbase.sh
check the port it listened, should be a port called 60030
then you can go the http://ip:60030 to see the hbase console of the given region. and 60010 for the hbase master
![image image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHKNY20zAEv_35ZafZ2rU81HOJ8ZRwYrL98WKTDjU5FV49GKWMpUiTJTvpakFIcfGrojqj0zynuNxPEoCafAzLqYiPB3cyR3AAWxoa4X0Y9pF6nNK6k6nTUK7pub85KguRXcnWdhurizo/?imgmax=800)
![image image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9r4EzefqPBcTJHMwqOb6T9HdkdzanFAfrQHVyRa7yBig21_KNH0ko4xijZnQhBqae2-4744vued8p3OnueVXZkpBxjRZxKbnJrZjs5UbwG5PMX2qzlNaWxz0SdbprE6Zs1fsiWDrFr_0/?imgmax=800)
then create a table and put a record
![image image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYzLkr1WyXf5zj489yks18B2Tnl13QKPM_A88w5SBRDjNhktnuSZzKzyKvDryRZtoyyoPmKVkLv3cIoI-9CMF-tQe9S4l5BO8tIxHqWe-d8Qd1aAh2EfFvI4Y7fNRTjGAq3rPV438t-fU/?imgmax=800)
check the folder
![image image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfR_zt0QuKtAztBgHEiPOtJlALIvUKpa0Wn3GCmaZszDmCrxoSprCeHZYQY0uuRwS5kvMg00hFk2qr88sNPh3H2v02KqecSdsaASYPYvpr7DUkAOrhsLKiVPtpG9NrDb4pzkU0NdJLKQQ/?imgmax=800)
Now let’s write a basic java program to read the data in hbase.
Create a new maven project by clicking the eclipse wizard,
Click the pom.xml, right click to add one dependency hbase.
![image_thumb[3] image_thumb[3]](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhE_rGzsBWm4Zz7sxcelRQKYwbUmJrsyS3SJ90L63IAFlDozirfmNm_G_uZJPVGM78O7jXTbubsAYnlmjDfS4OdO2l_aFvR2TXV7nDWRrd4ZY5zvosWqmtCIA69kzRfxhIt7hsYaUl3gYo/?imgmax=800)
Simple Query in another server, make sure the zookeeper ip and host name are accessible from client machine,
![image image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJnyP0NEUKbcm-17djhqcVg6fVp2Y_XYC27LZiB1AgGiB5B63n_xxD35vsEgaqQ19CWwFdHgU8tbJWaJFnlPzCllGHkUMf0rLIExXydcjzZMB8Uq-PwijthdRVPMIDeK-rJYek0KDxuWM/?imgmax=800)
for the coprocessor, they are bascailly observers in 3 levels.
Master level, you can hookup with all the DDL like create table,update column,etc (check BaseMasterObserver)
and DML level in the region servers,
![image image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggmmuxFVrl-ElyhnlLtLZRZX5JVhJ_RPiNJ1cztPolucXczxxv6K_Eys3BubZ4VoRomjPfRVOv89RKPJALU0RsymhDzSFwsnNpR4aRQZWk8xOX6xurakUNOWTHe9mEHfHyFRpIhprj73M/?imgmax=800)
And WAL level, all changes going to WAL, basically you can see all the changes. you can even reject the change
I will put the WALobserver as a example, just dump out any changes to the cluseter, we can send the changeset to another server do secondary indexing, or for logging /auditing purpose.
![image image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUknUnL-b-B-_87GusFIzoxnQEKQUvK3t1_hSPYYapeTcsPrR-rErGWN9_-zoG3kMZkUj035ra_df-r_XMNxBTlELal3h825B0CVz2myiC6K8PcIdKPkUR_Q0a2rKVOFIuD-1GqminxJE/?imgmax=800)
compile and package it to a jar file,then copy to the hbase lib folder, or any folder which is in the HBASE_CLASSPATH
then change hbase-site.xml, point to our WALobserver
![image image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3h11usBhDgWtUJr_45LzhKY2BT81o1ziLahU32U4YxsMPQbwpH_TDugAo8ulPYrbi_vp-HDonEYzGHxVU0veV37DaRcnEdX7AKay0zhSutp-REZcln9D8BpC8fO00c9raN_d3RiEyfrQ/?imgmax=800)
then restart the instance, from the region server, you can see our WAL is loaded,
![image image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyy-hFB6QDCqL8BEWCw3Gc1mfIWo__28BpybFGlw8EYE-bA8EctyiE0vG1IaOL152RNfyj_iOxYavsBocC1yerKzEZyosyQaxo8V94fihrj_R7JNpQalsgTaNJyX2i_nc-TTrGZzPZC3E/?imgmax=800)
then make some changes to the data,
from the log, you should see our logging , data changes captured here
![image image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjftqexx-khG1mW44K9eBgxynnx_JX0Rva7UNLyEhACWAMTO_K3EFU7B1pMH-HvdfD1Q-txiCy6CZXfMCytpxNlfMRfiqrm9s44UiN7BbZke7IMCvoFdWv3CVEmJGlvk3T9wFHSfpuyV8k/?imgmax=800)
Please note the WALobserver runs in the same JVM of the hbase, make sure not fail safe and no huge extra performance hit.