Return-Path: X-Original-To: apmail-hbase-user-archive@www.apache.org Delivered-To: apmail-hbase-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 78845E7FD for ; Thu, 24 Jan 2013 03:53:54 +0000 (UTC) Received: (qmail 36154 invoked by uid 500); 24 Jan 2013 03:53:52 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 35260 invoked by uid 500); 24 Jan 2013 03:53:50 -0000 Mailing-List: contact user-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hbase.apache.org Delivered-To: mailing list user@hbase.apache.org Received: (qmail 35186 invoked by uid 99); 24 Jan 2013 03:53:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Jan 2013 03:53:47 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of kylelin2000@gmail.com designates 209.85.220.44 as permitted sender) Received: from [209.85.220.44] (HELO mail-pa0-f44.google.com) (209.85.220.44) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Jan 2013 03:53:42 +0000 Received: by mail-pa0-f44.google.com with SMTP id hz11so5219057pad.31 for ; Wed, 23 Jan 2013 19:53:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=WB03iEBZeaHi+WMakjMvRjgEFnas5gDoArMFnNMEkwU=; b=LkX1Sig8W6JaZdxm4RDhKIBT9uGpFnfbFf4utiLdnbK/M9MxFgsucsQzXb0Yb9492O bAMpbmMsociCnqzENH3V2XwEogfjIoJRek/dgpNUxl8Ukx868cD9rGqRwtsK8e0ALDy1 oL5aiRE9c8JVTG9n3YIKmTm/fqF6VbVKiB04jROzyxg/7Jw41mO0n94ONXKYChdvZfYL Vnf0oNZr+5CwNB7UVVWS1I19AENV/TJuja/hI2G86K7H2VU7r5WKx2f+E1FzA8j3aXGs 6CbnZDQJcajRiTN9PYAv82e3uxFUnYKWZ4TdzFAonaSVFuTrq2+TERWw82yTpIdA8oGp mjOQ== MIME-Version: 1.0 X-Received: by 10.68.241.136 with SMTP id wi8mr1333263pbc.95.1358999602161; Wed, 23 Jan 2013 19:53:22 -0800 (PST) Received: by 10.68.0.169 with HTTP; Wed, 23 Jan 2013 19:53:22 -0800 (PST) In-Reply-To: <1358991856.92023.YahooMailNeo@web74305.mail.tp2.yahoo.com> References: <1358991856.92023.YahooMailNeo@web74305.mail.tp2.yahoo.com> Date: Thu, 24 Jan 2013 11:53:22 +0800 Message-ID: Subject: Re: How to get coprocessor list by client API From: Kyle Lin To: user@hbase.apache.org Content-Type: multipart/alternative; boundary=047d7b339cad89666004d400c00f X-Virus-Checked: Checked by ClamAV on apache.org --047d7b339cad89666004d400c00f Content-Type: text/plain; charset=Big5 Content-Transfer-Encoding: quoted-printable Hello JM It really works! Thanks a lot. Hello Jack For each table, it needs to use htable.getTableDescriptor(). hbaseAdmin.getTableDescriptor only gets -ROOT- and .META. So I use the code as follows, HTable htable =3D new HTable(config, tableName); HTableDescriptor htableDesc =3D *htable.getTableDescriptor()*; Map maps =3D htableDesc.getValues(); Set> sets =3D maps.entrySet(); for (Map.Entry entrySet : sets) { String stringKey =3D Bytes.toString(entrySet.getKey().get()); String stringValue =3D Bytes.toString(entrySet.getValue().get()); System.out.println("key:" + stringKey + ", value:" + stringValue); } htable.close(); Kyle 2013/1/24 jack > Hi, Kyle > > Configuration config =3D 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 =3D new HBaseAdmin(config); > > HTableDescriptor htableDescriptor =3D > hbaseAdmin.getTableDescriptor(Bytes.toBytes("table21")); > > Map maps =3D > htableDescriptor.getValues(); > Set> sets = =3D > maps.entrySet(); > Iterator> i= t > =3D sets.iterator(); > while(it.hasNext()){ > Entry > keys =3D it.next(); > ImmutableBytesWritable ibwKey =3D keys.getKey(); > ImmutableBytesWritable ibwValue =3D keys.getValue(); > String stringKey =3D Bytes.toString(ibwKey.get()); > String stringValue =3D Bytes.toString(ibwValue.get()); > System.out.println(stringKey + " " + stringValue); > } > hbaseAdmin.close(); > > > > > ________________________________ > =B1H=A5=F3=AA=CC=A1G Kyle Lin > =A6=AC=A5=F3=AA=CC=A1G user@hbase.apache.org > =B1H=A5=F3=A4=E9=B4=C1=A1G 2013/1/23 (=B6g=A4T) 4:18 PM > =A5D=A6=AE=A1G How to get coprocessor list by client API > > Hi, Everyone > > I need to know What coprocessors registered in a HTable. But, in Clas= s > 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 =3D> 'table21', *coprocessor$1 =3D> > 'hdfs://host3:9000/sumCoprocessor.jar|idv.jack.endpoint true > * > * .SumDataEndpoint||'*, FAMILIES =3D> [{NAME =3D> 'cf', DATA_BLOCK_ENCODI= NG =3D> > 'NONE', BLOOMFILTER > =3D> 'NONE', REPLICATION_SCOPE =3D> '0', VERSIONS =3D> '3', COMPRESSION = =3D> > 'NONE', MIN_VERSIONS =3D> > '0', TTL =3D> '2147483647', KEEP_DELETED_CELLS =3D> 'false', BLOCKSIZE = =3D> > '65536', IN_MEMORY =3D> > 'false', ENCODE_ON_DISK =3D> 'true', BLOCKCACHE =3D> 'true'}]} > > 1 row(s) in 0.0210 seconds > > Kyle > --047d7b339cad89666004d400c00f--