Custom Hbase filter on cloudera hbase 1.2.0 cluster

I am trying to deploy a custom filter to my hbase cluster. According to the cloudera docs [1], dynamic loading of filters should be enabled by default.

My hbase.rootdir /hbase

To deploy my own filter, I created a directory /hbase/lib

in hdfs and put my jar in it. Then I tried to use a custom filter from the intrinsically safe job:

object MyFilterTest {
  def main(args: Array[String]): Unit = {
    [...]
     val filter = new MyFilter()

     val scan = new Scan()
     scan.setFilter(filter)

     try {
       val rdd = hbaseContext.hbaseRDD(TableName.valueOf("some_table"), scan)
       val rowKeys = rdd.map(tuple => Bytes.toString(tuple._1.get))
       rowKeys.saveAsTextFile(outputPath)
     } finally {
       sparkContext.stop()
     }
   }
 }

      

But it failed with a ClassNotFoundException indicating that MyFilter could not be found. To investigate, I set the log level to DEBUG and looked at the org.apache.hbase.util.DynamicClassLoader entries in the logs but couldn't find them at all. Intrigued by this fact, I tried to set the appropriate settings explicitly. In the safety valve hbase-site.xml I have set this config:

<property>
  <name>hbase.dynamic.jars.dir</name>
  <value>hdfs://myhdfs.host:8020/hbase/lib</value>
  <final>true</final>
</property>
<property>
  <name>hbase.local.dir</name>
  <value>/tmp/hbase-root/local</value>
  <final>true</final>
</property>
<property>
  <name>hbase.use.dynamic.jars</name>
  <value>true</value>
  <final>true</final>
</property>

      

But still it didn't work and there were no logs indicating that hbase even tried to load jars from hdfs.

Is there some configuration I forgot?

[1] https://www.cloudera.com/documentation/enterprise/5-8-x/topics/admin_hbase_filtering.html

+3


source to share





All Articles