修改emr集群, 添加如下配置:
<property>
<name>hbase.coprocessor.user.region.classes</name>
<value>org.apache.hadoop.hbase.coprocessor.AggregateImplementation</value>
</property>
打开hbase shell
sudo hbase shell
disable 'your-table-name'
alter 'your-table-name', METHOD => 'table_att', 'coprocessor' => '|org.apache.hadoop.hbase.coprocessor.AggregateImplementation|1001|'
enable 'your-table-name'
编译打包后,把jar包 (带有with-dependencies.jar)放到emr主节点上
运行
java -jar stathbase-0.0.1-jar-with-dependencies.jar conf.json
- 代码编译环境最好和emr master环境一致,或者代码提交到emr master上执行