【问题标题】:User Define HBase Coprocessor Implementation for secondary用于辅助的用户定义 HBase 协处理器实现
【发布时间】:2020-04-05 17:09:11
【问题描述】:

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

DatabaseCrudCoprocessor.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);
        }
    }
}

HBase 上的 Log.Errors > > >

在 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),服务=区域服务器状态服务 1266 [master/localhost:60000:becomeActiveMaster] 错误 org.apache.hadoop.hbase.master.RegionServerTracker - localhost,60020,1576052978374 没有匹配的 ServerCrashProcedure 1266 [master/localhost:60000:becomeActiveMaster] 错误 org.apache.hadoop.hbase.master.RegionServerTracker - localhost,60020,1539250172019 没有匹配的 ServerCrashProcedure 1266 [master/localhost:60000:becomeActiveMaster] 错误 org.apache.hadoop.hbase.master.RegionServerTracker - localhost,60020,1576071410923 没有匹配的 ServerCrashProcedure 1266 [master/localhost:60000:becomeActiveMaster] 错误 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] 错误 org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost - demo.DatabaseCrudCoprocessor 不是 RegionCoprocessor 类型。检查 hbase.coprocessor.region.classes 的配置 167 [RS_CLOSE_META-regionserver/localhost:60020-0] 错误 org.apache.hadoop.hbase.coprocessor.CoprocessorHost - 无法加载协处理器 DatabaseCrudCoprocessor 1302 [RS-EventLoopGroup-1-4] 信息 SecurityLogger.org.apache.hadoop.hbase.Server - 来自 127.0.0.1:33830 的连接,版本 = 2.2.2,sasl = false,ugi = hadoop(身份验证:简单),服务=客户服务

【问题讨论】:

    标签: hadoop hbase


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

      要成为RegionCoprocessor,你的班级还应该实现org.apache.hadoop.hbase.coprocessor.RegionCoprocessor

      【讨论】:

      • 我尝试添加 RegionCoprocessor 仍然显示相同的错误。
      猜你喜欢
      • 1970-01-01
      • 2013-08-03
      • 2018-12-07
      • 2012-12-13
      • 2013-01-10
      • 2014-11-14
      • 1970-01-01
      • 2012-03-13
      • 1970-01-01
      相关资源
      最近更新 更多