You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Amit Sela <am...@infolinks.com> on 2012/06/07 15:12:58 UTC
Dynamic load of Coprocessors
Hi all,
I can't seem to understand if there is a way to dynamically load
coprocessors ?
The best way I found so far is using the shell:
*alter 'URLS', METHOD => 'table_att',
'coprocessor'=>'|com.infolinks.hbase.coprocessors.HBaseTestRegionObserver||'
*
I leave the path empty because I put the jar in my file path and I don't
use priority or arguments.
After re-enabling I don't see the coprocessor in the webapp. I also tried
re-starting hbase which didn't help as well...
Is there a need to add to the configuration as well ? if so, does it mean
that re-starting HBase is mandatory when adding/removing coprocessors ?
Is there a dynamic load method ? without disable/enable to the table ?
Thanks.
Re: Dynamic load of Coprocessors
Posted by Keith Wyss <ke...@explorys.com>.
I apologize for hit send with an incomplete message.
I will add that the ticket is HBASE-1936: ClassLoader that loads from HDFS.
If I am not mistaken, this could be used to load coprocessors and filters
without a grid or table bounce.
Perhaps someone more in tune than me has more information.
Cheers,
Keith
On 6/7/12 9:44 AM, "Keith Wyss" <ke...@explorys.com> wrote:
>I believe there is a ticket relevant to your issue under current
>development.
>
>
>On 6/7/12 9:28 AM, "Marcos Ortiz" <ml...@uci.cu> wrote:
>
>>You should see the explaination on the HBase´s book
>>
>>hbase.coprocessor.region.classes
>>
>>A comma-separated list of Coprocessors that are loaded by default on all
>>tables. For any override coprocessor method, these classes will be
>>called in order. After implementing your own Coprocessor, just put it in
>>HBase's classpath and add the fully qualified class name here. A
>>coprocessor can also be loaded on demand by setting HTableDescriptor.
>>
>>Default:
>>
>>hbase.coprocessor.master.classes
>>
>>A comma-separated list of
>>org.apache.hadoop.hbase.coprocessor.MasterObserver coprocessors that are
>>loaded by default on the active HMaster process. For any implemented
>>coprocessor methods, the listed classes will be called in order. After
>>implementing your own MasterObserver, just put it in HBase's classpath
>>and add the fully qualified class name here.
>>
>>Default:
>>
>>Like the first parameter say, you should use the
>>HTableDescriptor.setValue() method to load Coprocessors classes on
>>demand:
>>Syntax: <path-to-jar>|<classname>|<priority>
>>
>>Example of the Lars George's book:
>> 'COPROCESSOR$1' => \
>>'hdfs://localhost:8020/users/leon/test.jar|coprocessor.Test|SYSTEM'
>>'COPROCESSOR$2' => \
>>'/Users/laura/test2.jar|coprocessor.AnotherTest|USER'
>>
>>I hope that you solve.
>>Regards
>>
>>
>>
>>On 06/07/2012 09:12 AM, Amit Sela wrote:
>>> Hi all,
>>>
>>> I can't seem to understand if there is a way to dynamically load
>>> coprocessors ?
>>>
>>> The best way I found so far is using the shell:
>>>
>>> *alter 'URLS', METHOD => 'table_att',
>>>
>>>'coprocessor'=>'|com.infolinks.hbase.coprocessors.HBaseTestRegionObserve
>>>r
>>>||'
>>> *
>>>
>>> I leave the path empty because I put the jar in my file path and I
>>>don't
>>> use priority or arguments.
>>>
>>> After re-enabling I don't see the coprocessor in the webapp. I also
>>>tried
>>> re-starting hbase which didn't help as well...
>>>
>>> Is there a need to add to the configuration as well ? if so, does it
>>>mean
>>> that re-starting HBase is mandatory when adding/removing coprocessors ?
>>>
>>> Is there a dynamic load method ? without disable/enable to the table ?
>>>
>>> Thanks.
>>>
>>>
>>> 10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS
>>>INFORMATICAS...
>>> CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION
>>>
>>> http://www.uci.cu
>>> http://www.facebook.com/universidad.uci
>>> http://www.flickr.com/photos/universidad_uci
>>
>>--
>>Marcos Luis Ortíz Valmaseda
>> Data Engineer&& Sr. System Administrator at UCI
>> http://marcosluis2186.posterous.com
>> http://www.linkedin.com/in/marcosluis2186
>> Twitter: @marcosluis2186
>>
>>
>>
>>10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS
>>INFORMATICAS...
>>CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION
>>
>>http://www.uci.cu
>>http://www.facebook.com/universidad.uci
>>http://www.flickr.com/photos/universidad_uci
>
Re: Dynamic load of Coprocessors
Posted by Keith Wyss <ke...@explorys.com>.
I believe there is a ticket relevant to your issue under current
development.
On 6/7/12 9:28 AM, "Marcos Ortiz" <ml...@uci.cu> wrote:
>You should see the explaination on the HBase´s book
>
>hbase.coprocessor.region.classes
>
>A comma-separated list of Coprocessors that are loaded by default on all
>tables. For any override coprocessor method, these classes will be
>called in order. After implementing your own Coprocessor, just put it in
>HBase's classpath and add the fully qualified class name here. A
>coprocessor can also be loaded on demand by setting HTableDescriptor.
>
>Default:
>
>hbase.coprocessor.master.classes
>
>A comma-separated list of
>org.apache.hadoop.hbase.coprocessor.MasterObserver coprocessors that are
>loaded by default on the active HMaster process. For any implemented
>coprocessor methods, the listed classes will be called in order. After
>implementing your own MasterObserver, just put it in HBase's classpath
>and add the fully qualified class name here.
>
>Default:
>
>Like the first parameter say, you should use the
>HTableDescriptor.setValue() method to load Coprocessors classes on demand:
>Syntax: <path-to-jar>|<classname>|<priority>
>
>Example of the Lars George's book:
> 'COPROCESSOR$1' => \
>'hdfs://localhost:8020/users/leon/test.jar|coprocessor.Test|SYSTEM'
>'COPROCESSOR$2' => \
>'/Users/laura/test2.jar|coprocessor.AnotherTest|USER'
>
>I hope that you solve.
>Regards
>
>
>
>On 06/07/2012 09:12 AM, Amit Sela wrote:
>> Hi all,
>>
>> I can't seem to understand if there is a way to dynamically load
>> coprocessors ?
>>
>> The best way I found so far is using the shell:
>>
>> *alter 'URLS', METHOD => 'table_att',
>>
>>'coprocessor'=>'|com.infolinks.hbase.coprocessors.HBaseTestRegionObserver
>>||'
>> *
>>
>> I leave the path empty because I put the jar in my file path and I don't
>> use priority or arguments.
>>
>> After re-enabling I don't see the coprocessor in the webapp. I also
>>tried
>> re-starting hbase which didn't help as well...
>>
>> Is there a need to add to the configuration as well ? if so, does it
>>mean
>> that re-starting HBase is mandatory when adding/removing coprocessors ?
>>
>> Is there a dynamic load method ? without disable/enable to the table ?
>>
>> Thanks.
>>
>>
>> 10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS
>>INFORMATICAS...
>> CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION
>>
>> http://www.uci.cu
>> http://www.facebook.com/universidad.uci
>> http://www.flickr.com/photos/universidad_uci
>
>--
>Marcos Luis Ortíz Valmaseda
> Data Engineer&& Sr. System Administrator at UCI
> http://marcosluis2186.posterous.com
> http://www.linkedin.com/in/marcosluis2186
> Twitter: @marcosluis2186
>
>
>
>10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS
>INFORMATICAS...
>CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION
>
>http://www.uci.cu
>http://www.facebook.com/universidad.uci
>http://www.flickr.com/photos/universidad_uci
Re: Dynamic load of Coprocessors
Posted by Marcos Ortiz <ml...@uci.cu>.
You should see the explaination on the HBase´s book
hbase.coprocessor.region.classes
A comma-separated list of Coprocessors that are loaded by default on all
tables. For any override coprocessor method, these classes will be
called in order. After implementing your own Coprocessor, just put it in
HBase's classpath and add the fully qualified class name here. A
coprocessor can also be loaded on demand by setting HTableDescriptor.
Default:
hbase.coprocessor.master.classes
A comma-separated list of
org.apache.hadoop.hbase.coprocessor.MasterObserver coprocessors that are
loaded by default on the active HMaster process. For any implemented
coprocessor methods, the listed classes will be called in order. After
implementing your own MasterObserver, just put it in HBase's classpath
and add the fully qualified class name here.
Default:
Like the first parameter say, you should use the
HTableDescriptor.setValue() method to load Coprocessors classes on demand:
Syntax: <path-to-jar>|<classname>|<priority>
Example of the Lars George's book:
'COPROCESSOR$1' => \
'hdfs://localhost:8020/users/leon/test.jar|coprocessor.Test|SYSTEM'
'COPROCESSOR$2' => \
'/Users/laura/test2.jar|coprocessor.AnotherTest|USER'
I hope that you solve.
Regards
On 06/07/2012 09:12 AM, Amit Sela wrote:
> Hi all,
>
> I can't seem to understand if there is a way to dynamically load
> coprocessors ?
>
> The best way I found so far is using the shell:
>
> *alter 'URLS', METHOD => 'table_att',
> 'coprocessor'=>'|com.infolinks.hbase.coprocessors.HBaseTestRegionObserver||'
> *
>
> I leave the path empty because I put the jar in my file path and I don't
> use priority or arguments.
>
> After re-enabling I don't see the coprocessor in the webapp. I also tried
> re-starting hbase which didn't help as well...
>
> Is there a need to add to the configuration as well ? if so, does it mean
> that re-starting HBase is mandatory when adding/removing coprocessors ?
>
> Is there a dynamic load method ? without disable/enable to the table ?
>
> Thanks.
>
>
> 10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS INFORMATICAS...
> CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION
>
> http://www.uci.cu
> http://www.facebook.com/universidad.uci
> http://www.flickr.com/photos/universidad_uci
--
Marcos Luis Ortíz Valmaseda
Data Engineer&& Sr. System Administrator at UCI
http://marcosluis2186.posterous.com
http://www.linkedin.com/in/marcosluis2186
Twitter: @marcosluis2186
10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS INFORMATICAS...
CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION
http://www.uci.cu
http://www.facebook.com/universidad.uci
http://www.flickr.com/photos/universidad_uci
Re: Dynamic load of Coprocessors
Posted by NNever <nn...@gmail.com>.
*1.Coprocessor on all tables:*
When coprocessor on all tables, config hbase-site.xml:
> <property>
> <name>hbase.coprocessor.region.classes</name>
> <value>cp classPath....</value>
> </property>
and config the hbase-env.sh
> # Extra Java CLASSPATH elements. Optional.
> export
> HBASE_CLASSPATH=$HBASE_HOME/libextra/xxx.jar:$HBASE_HOME/libextra/xxxb.jar
then the coprocessor class are added to the classpath of HBase, It will
autoload it.
*This type of coprocessor could not load dynamic*
*2.Coprocessor on single table:*
When attach to a single table, just the the table's coprocessor attr...put
the jar in the HDFS on somewhere where attr point to:
> alter 'TableName', METHOD => 'table-att', 'COPROCESSOR' => '
> hdfs://localhost:8020/users/**leon/test.jar|coprocessor.**Test||[some
> attrs you can use inside the coprocessor]'
like this, *the coprocessor will dynamic loaded, you can replace this jar
without restart hbase*.
Or you can leave the jar path blank:
> alter 'TableName', METHOD => 'table-att', 'COPROCESSOR' => ' |coprocessor.
> **Test||[some attrs you can use inside the coprocessor]'
and config the hbase-env.sh
> # Extra Java CLASSPATH elements. Optional.
> export
> HBASE_CLASSPATH=$HBASE_HOME/libextra/xxx.jar:$HBASE_HOME/libextra/xxxb.jar
So the coprocessor class in the jar are loaded to hbase's classpath when
start.
*This config of single-talbe coprocessor cannot load dynamic, too.*
Wish it helps.
Yours,
NN
2012/6/7 Andrew Purtell <ap...@apache.org>
> When using the table attribute method you must specify a fully qualified
> Hadoop path URI to a jar, and it must be accessible to all regionservers
> i.e. on HDFS. (When opening a region of this table the regionserver will
> use the Hadoop Filesystem abstraction to copy the jar to a local temporary
> directory and then load the specified coprocessor class from it.)
>
> Since you put it on the classpath of the regionservers instead, you can
> update the hbase-site.xml file to load it as a system coprocessor according
> to the instructions in the HBase online manual.
>
> - Andy
>
> On Thursday, June 7, 2012, Amit Sela wrote:
>
> > Hi all,
> >
> > I can't seem to understand if there is a way to dynamically load
> > coprocessors ?
> >
> > The best way I found so far is using the shell:
> >
> > *alter 'URLS', METHOD => 'table_att',
> >
> >
> 'coprocessor'=>'|com.infolinks.hbase.coprocessors.HBaseTestRegionObserver||'
> > *
> >
> > I leave the path empty because I put the jar in my file path and I don't
> > use priority or arguments.
> >
> > After re-enabling I don't see the coprocessor in the webapp. I also tried
> > re-starting hbase which didn't help as well...
> >
> > Is there a need to add to the configuration as well ? if so, does it mean
> > that re-starting HBase is mandatory when adding/removing coprocessors ?
> >
> > Is there a dynamic load method ? without disable/enable to the table ?
> >
> > Thanks.
> >
>
>
> --
> Best regards,
>
> - Andy
>
> Problems worthy of attack prove their worth by hitting back. - Piet Hein
> (via Tom White)
>
Re: Dynamic load of Coprocessors
Posted by Andrew Purtell <ap...@apache.org>.
When using the table attribute method you must specify a fully qualified
Hadoop path URI to a jar, and it must be accessible to all regionservers
i.e. on HDFS. (When opening a region of this table the regionserver will
use the Hadoop Filesystem abstraction to copy the jar to a local temporary
directory and then load the specified coprocessor class from it.)
Since you put it on the classpath of the regionservers instead, you can
update the hbase-site.xml file to load it as a system coprocessor according
to the instructions in the HBase online manual.
- Andy
On Thursday, June 7, 2012, Amit Sela wrote:
> Hi all,
>
> I can't seem to understand if there is a way to dynamically load
> coprocessors ?
>
> The best way I found so far is using the shell:
>
> *alter 'URLS', METHOD => 'table_att',
>
> 'coprocessor'=>'|com.infolinks.hbase.coprocessors.HBaseTestRegionObserver||'
> *
>
> I leave the path empty because I put the jar in my file path and I don't
> use priority or arguments.
>
> After re-enabling I don't see the coprocessor in the webapp. I also tried
> re-starting hbase which didn't help as well...
>
> Is there a need to add to the configuration as well ? if so, does it mean
> that re-starting HBase is mandatory when adding/removing coprocessors ?
>
> Is there a dynamic load method ? without disable/enable to the table ?
>
> Thanks.
>
--
Best regards,
- Andy
Problems worthy of attack prove their worth by hitting back. - Piet Hein
(via Tom White)