Comencau
Comencau

Reputation: 1193

HBase filter - How to dynamically upload filter on HBase server side

I use HBase 0.94.20. I don't find how to make a custom HBase Filter beeing available and executed on the HBase server side. Reading https://issues.apache.org/jira/browse/HBASE-1936, I understand it is now possible to do it without having to manually copy a jar containing the filter on HBase server side. But after several hours of googling and testing, I did not find how to send this custom filter from my java code to the HBase server side.

I keep having the error in HBase logs :

java.lang.RuntimeException: Can't find class com.company.MyHBaseFilter
at org.apache.hadoop.hbase.util.Classes.createWritableForName(Classes.java:121)
at org.apache.hadoop.hbase.client.Scan.readFields(Scan.java:642)
at org.apache.hadoop.hbase.io.HbaseObjectWritable.readObject(HbaseObjectWritable.java:693)

So to start simple, here is the basic code. What Am I supposed to add to make the logic in MyHBaseFilter executed on the server side ? (note : MyHBaseFilter extends FilterBase)

Filter filter = new MyHBaseFilter(some_args);
scan.setFilter(filter);
ResultScanner rs = table.getScanner(scan);

Thank you

Upvotes: 1

Views: 1100

Answers (1)

Ben
Ben

Reputation: 187

Assuming hbase is configured in distributed mode and running on top of HDFS:

  • Check your hbase conf: $HBASE_HOME/conf/hbase-site.xml and find out the root dir of your hbase data(the value of hbase.rootdir )
  • And use hadoop cmd to put your custom filter jar under ${hbase.rootdir}/lib which is the default location of hbase.use.dynamic.jars

If you are using a hbase brought up by others, you MIGHT need to search hbase.use.dynamic.jars in your hbase-site.xml first to make sure the default root dir is not changed by others. Checkhbase.dynamic.jars.dir

Upvotes: 1

Related Questions