Skip to content

Latest commit

 

History

History
64 lines (46 loc) · 1.5 KB

README.md

File metadata and controls

64 lines (46 loc) · 1.5 KB

HbaseWALSecondary

simple Demo using Solr as the seconady index by overriding the Hbase WALObserver

basica Idea,

Implement a WALObserver which listens for all data chagne to hbase, then comstruct as a solr document, pushed the chagne to solr on the fly.

mvn package

change hbase-site.xml, add our walobserver

hbase.coprocessor.wal.classes com.androidyou.extension.SimpleWALObserver

For hbase to pickup the jar dependencies,

Change the hbase-env.sh those classpaths can be generated by mvn dependency:build-classpath

and also add the jar in the classpath folder

test,

start the solr instance , under the examples folder.
java -jar start.jar create one table in hbase named whatever, and one column family named c1 create 'demo','c1'

then put some data with c1 as column faily, and cat as the qualifier

 put 'demo','row-001','c1:cat','happy'

in the solr query, you can see the docs

  <response>
<lst name="responseHeader">
  <int name="status">0</int>
  <int name="QTime">0</int>
  <lst name="params">
    <str name="indent">true</str>
    <str name="q">id:row-001</str>
    <str name="_">1380559142051</str>
    <str name="wt">xml</str>
  </lst>
</lst>
<result name="response" numFound="1" start="0">
  <doc>
    <str name="id">row-001</str>
    <arr name="cat">
      <str>happy</str>
    </arr>
    <long name="_version_">1447621113185042432</long></doc>
</result>
</response>