用户定义 HBase 协处理器实现次级



我正在尝试在我的系统上本地添加用于辅助存储目的的用户定义协处理器,我已经参考了"https://www.3pillarglobal.com/insights/hbase-coprocessors"链接来实现。当我尝试进行静态协处理器加载时,我收到一些与区域协处理器相关的错误,说提及分类不是区域协处理器的类型。请帮助我完成此功能。

DatabaseCrud协处理器.java>实现>

@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
@InterfaceStability.Evolving
public class DatabaseCrudCoprocessor  implements RegionObserver {
private static final String className = "DatabaseCrudCoprocessor";
private static JsonObject object = new JsonObject();
static final CloudLogger logger = CloudLogger.getLogger("DatabaseCrudCoprocessor");

public void postPut(ObserverContext<RegionCoprocessorEnvironment> c, Put put, WALEdit edit, Durability durability)
throws IOException {
try {
Connection con = c.getEnvironment().getConnection();
logger.info("---------------------This Code Is Excecute---------------------------");
}catch(Exception e) {
logger.error("In "+className+" postPut : Exception : "+e);
}
}
}

Log.Errors on HBase>>>

On Hadoop-Master>>>>>>

SLF4J: Class path contains multiple SLF4J bindings.

SLF4J: 在 [jar:file:/home/hadoop/hbase/hbase/lib/demo-0.0.2-SNAPSHOT-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class] 中找到绑定 SLF4J: 在 [jar:file:/home/hadoop/hbase/hbase/lib/phoenix-5.0.0-HBase-2.0-client.jar!/org/slf4j/impl/StaticLoggerBinder.class] 中找到了绑定 SLF4J: 在 [jar:file:/home/hadoop/hbase/hbase/lib/phoenix-5.0.0-HBase-2.0-hive.jar!/org/slf4j/impl/StaticLoggerBinder.class] 中找到了绑定 SLF4J: 在 [jar:file:/home/hadoop/hbase/hbase/lib/phoenix-5.0.0-HBase-2.0-pig.jar!/org/slf4j/impl/StaticLoggerBinder.class] 中找到了绑定 SLF4J: 在 [jar:file:/home/hadoop/hbase/hbase/lib/phoenix-5.0.0-HBase-2.0-thin-client.jar!/org/slf4j/impl/StaticLoggerBinder.class] 中找到了绑定 SLF4J: 在 [jar:file:/home/hadoop/hbase/hbase/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class] 中找到绑定 SLF4J:有关解释,请参阅 http://www.slf4j.org/codes.html#multiple_bindings。 SLF4J:实际绑定的类型为 [org.slf4j.impl.Log4jLoggerFactory] 0 [RS-EventLoopGroup-1-2] INFO SecurityLogger.org.apache.hadoop.hbase.Server - 来自 127.0.0.1:45903 的连接,版本=2.2.2,sasl=false,ugi=hadoop (auth:SIMPLE(,service=RegionServerStatusService 1266 [master/localhost:60000:becomeActiveMaster] ERROR org.apache.hadoop.hbase.master.RegionServerTracker - localhost,60020,1576052978374 没有匹配的 ServerCrashProcedure 1266 [master/localhost:60000:becomeActiveMaster] ERROR org.apache.hadoop.hbase.master.RegionServerTracker - localhost,60020,1539250172019 没有匹配的 ServerCrashProcedure 1266 [master/localhost:60000:becomeActiveMaster] ERROR org.apache.hadoop.hbase.master.RegionServerTracker - localhost,60020,1576071410923 没有匹配的 ServerCrashProcedure 1266 [master/localhost:60000:becomeActiveMaster] ERROR org.apache.hadoop.hbase.master.RegionServerTracker - localhost,60020,1576127072238 没有匹配的 ServerCrashProcedure

在区域服务器上>>>>>>>>

0    [RS-EventLoopGroup-1-3] INFO  SecurityLogger.org.apache.hadoop.hbase.Server  - Connection from 127.0.0.1:33828, version=2.2.2, sasl=false, ugi=hadoop (auth:SIMPLE), service=AdminService

167 [RS_CLOSE_META-regionserver/localhost:60020-0] ERROR org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost - demo.DatabaseCrudCoprocessor 不是 RegionCoprocessor 类型。检查 hbase.coprocessor.region.classes 的配置 167 [RS_CLOSE_META-regionserver/localhost:60020-0] ERROR org.apache.hadoop.hbase.coprocessor.CoprocessorHost - 无法加载协处理器 DatabaseCrudCoprocessor 1302 [RS-EventLoopGroup-1-4] INFO SecurityLogger.org.apache.hadoop.hbase.Server - 来自 127.0.0.1:33830 的连接,版本=2.2.2,sasl=false,ugi=hadoop (auth:SIMPLE(,service=ClientService

尝试实现 RegionCoprocessor 和 RegionObserver 并覆盖 getRegionObserver(( 方法。如果您使用的是 hbase 2.0 版本

public class RegionObserverExample implements RegionCoprocessor, RegionObserver {
@Override
public Optional<RegionObserver> getRegionObserver() {
return Optional.of(this);
}
...
}

要成为RegionCoprocessor你的类也应该实现org.apache.hadoop.hbase.coprocessor.RegionCoprocessor

最新更新