Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # user >> How to get coprocessor list by client API


Copy link to this message
-
RE: How to get coprocessor list by client API
Hi, Kyle

        Configuration config = HBaseConfiguration.create();
        config.set("hbase.zookeeper.quorum", "host3");
        config.set("hbase.zookeeper.property.clientPort", "2181");
   
        config.set("fs.default.name", "hdfs://host3:9000");
        config.set("mapred.job.tracker", "hdfs://host3:9001");
       
        HBaseAdmin hbaseAdmin = new HBaseAdmin(config);
       
        HTableDescriptor htableDescriptor = hbaseAdmin.getTableDescriptor(Bytes.toBytes("table21"));

        Map<ImmutableBytesWritable, ImmutableBytesWritable> maps = htableDescriptor.getValues();
        Set<Entry<ImmutableBytesWritable, ImmutableBytesWritable>> sets = maps.entrySet();
        Iterator<Entry<ImmutableBytesWritable, ImmutableBytesWritable>> it = sets.iterator();
        while(it.hasNext()){
                Entry<ImmutableBytesWritable, ImmutableBytesWritable>  keys = it.next();
                ImmutableBytesWritable ibwKey = keys.getKey();
                ImmutableBytesWritable ibwValue = keys.getValue();
                String stringKey = Bytes.toString(ibwKey.get());
                String stringValue = Bytes.toString(ibwValue.get());
                System.out.println(stringKey + "    " + stringValue);
        }
        hbaseAdmin.close();
________________________________
 寄件者: Kyle Lin <[EMAIL PROTECTED]>
收件者: [EMAIL PROTECTED]
寄件日期: 2013/1/23 (週三) 4:18 PM
主旨: How to get coprocessor list by client API
 
Hi, Everyone

    I need to know What coprocessors registered in a HTable. But, in Class
HTableDescriptor, I can only find
*addCoprocessor<http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/HTableDescriptor.html#addCoprocessor(java.lang.String)>
*, *hasCoprocessor<http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/HTableDescriptor.html#hasCoprocessor(java.lang.String)>
* ..etc. How can I use Client API to get the coprocessor information just
like Typing "describe table_name" in HBase Shell as follows?
hbase(main):002:0> describe 'table21'
DESCRIPTION
                  ENABLED
{NAME => 'table21', *coprocessor$1 =>
'hdfs://host3:9000/sumCoprocessor.jar|idv.jack.endpoint true
                               *
* .SumDataEndpoint||'*, FAMILIES => [{NAME => 'cf', DATA_BLOCK_ENCODING =>
'NONE', BLOOMFILTER
=> 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION =>
'NONE', MIN_VERSIONS =>
  '0', TTL => '2147483647', KEEP_DELETED_CELLS => 'false', BLOCKSIZE =>
'65536', IN_MEMORY =>
  'false', ENCODE_ON_DISK => 'true', BLOCKCACHE => 'true'}]}

1 row(s) in 0.0210 seconds

Kyle
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB