[maxiu@idayan00 hadoop-2.6.0-cdh5.8.0]$ bin/hdfs dfs -put /home/maxiu/myData/coprocessor-1.0-SNAPSHOT.jar /user/maxiu
18/03/15 11:09:20 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[maxiu@idayan00 hadoop-2.6.0-cdh5.8.0]$ bin/hdfs dfs -ls /user/maxiu
18/03/15 11:10:03 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 1 items
-rw-r--r-- 1 maxiu supergroup 2844 2018-03-15 11:09 /user/maxiu/coprocessor-1.0-SNAPSHOT.jar
我的jar:链接:https://pan.baidu.com/s/1vUw66lCjypE0EO8O3aO-5Q 密码:8wdm
step5
在HBase中启用这个观察者,登录服务器,使用hbase shell 执行以下命令:
hbase(main):002:0> create 'mytable','mycf' //创建表
0 row(s) in 1.5240 seconds
=> Hbase::Table - mytable
hbase(main):003:0> alter 'mytable' , METHOD =>'table_att','coprocessor'=>'hdfs://idayan00//user/maxiu/coprocessor-1.0-SNAPSHOT.jar|com.idayan.HelloWorldObserver||'
Updating all regions with the new schema... //启用协处理器
1/1 regions updated.
Done.
0 row(s) in 2.5410 seconds
hbase(main):005:0> alter 'mytable',METHOD =>'table_att_unset',NAME => 'coprocessor$1'
Updating all regions with the new schema...
1/1 regions updated.
Done.
0 row(s) in 2.5900 seconds
测试协处理器