近在项目测试中需要把CDH从5.13.3升级到5.16.2,升级过程中比较顺利,但是升级后HBase Master总是过一小会儿就出问题,HBase有两个Master,一主一备,正常情况下,查看HBase实例时应该是显示一个Master(主)和一个Master(备),但升级后看到主备状态,Region也无法OPEN,过一段时间后HBase Master出现异常,如下图所示:
虽然看似状态正常,但hbase shell的命令也不能正常工作,显示HBase处于initializing状态。
hbase(main):001:> list
TABLE
ERROR: org.apache.hadoop.hbase.PleaseHoldException: Master is initializing
at org.apache.hadoop.hbase.master.HMaster.checkInitialized(HMaster.java:2411)
at org.apache.hadoop.hbase.master.MasterRpcServices.getTableNames(MasterRpcServices.java:910)
at org.apache.hadoop.hbase.protobuf.generated.MasterProtos$MasterService$2.callBlockingMethod(MasterProtos.java:58682)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2191)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:112)
at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:183)
at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:163)
List all tables in hbase. Optional regular expression parameter could
be used to filter the output. Examples:
hbase> list
hbase> list 'abc.*'
hbase> list 'ns:abc.*'
hbase> list 'ns:.*'
一开始,我们认为是Zookeeper的问题,因为HBaster的主备切换依赖于Zookeeper,因此,我们删除了Zookeeper下面的hbase节点,删除了Zookeeper的/var/lib/zookeeper/version-2/下面的内容,重新初始化了Zookeeper。
[root@HXnode01 ~]# zookeeper-client
。。。
[zk: localhost:2181(CONNECTED) 5] rmr /hbase
//以下命令在所有Zookeeper节点上执行
rm -rf /var/lib/zookeeper/version-2/*
重新启动后发现HBase过一小段时间仍然不正常,HBase Master中并没有错误日志。于是我们检查RegionServer的日志,发现RegionServer日志中有如下报错,
2019-11-04 16:34:25,478 INFO org.apache.hadoop.hbase.regionserver.wal.FSHLog: Slow sync cost: 15 ms, current pipeline: []
2019-11-04 16:34:25,478 INFO org.apache.hadoop.hbase.regionserver.wal.FSHLog: New WAL /hbase/WALs/hxnode03.esgyn.cn,60020,1572856446548/hxnode03.esgyn.cn%2C60020%2C1572856446548.meta.1572856465458.meta
2019-11-04 16:34:25,498 ERROR org.apache.hadoop.hbase.regionserver.handler.OpenRegionHandler: Failed open of region=hbase:meta,,1.1588230740, starting to roll back the global memstore size.
java.lang.IllegalStateException: Could not instantiate a region instance.
at org.apache.hadoop.hbase.regionserver.HRegion.newHRegion(HRegion.java:6351)
at org.apache.hadoop.hbase.regionserver.HRegion.openHRegion(HRegion.java:6652)
at org.apache.hadoop.hbase.regionserver.HRegion.openHRegion(HRegion.java:6624)
at org.apache.hadoop.hbase.regionserver.HRegion.openHRegion(HRegion.java:6580)
at org.apache.hadoop.hbase.regionserver.HRegion.openHRegion(HRegion.java:6531)
at org.apache.hadoop.hbase.regionserver.handler.OpenRegionHandler.openRegion(OpenRegionHandler.java:362)
at org.apache.hadoop.hbase.regionserver.handler.OpenRegionHandler.process(OpenRegionHandler.java:129)
at org.apache.hadoop.hbase.executor.EventHandler.run(EventHandler.java:129)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class org.apache.hadoop.hbase.regionserver.transactional.TransactionalRegion not found
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2349)
at org.apache.hadoop.hbase.regionserver.HRegion.newHRegion(HRegion.java:6340)
... 10 more
Caused by: java.lang.ClassNotFoundException: Class org.apache.hadoop.hbase.regionserver.transactional.TransactionalRegion not found
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2255)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2347)
... 11 more
2019-11-04 16:34:25,503 INFO org.apache.hadoop.hbase.coordination.ZkOpenRegionCoordination: Opening of region {ENCODED => 1588230740, NAME => 'hbase:meta,,1', STARTKEY => '', ENDKEY => ''} failed, transitioning from OPENING to FAILED_OPEN in ZK, expecting version 16
根据错误信息“ java.lang.ClassNotFoundException: Class org.apache.hadoop.hbase.regionserver.transactional.TransactionalRegion not found”,我们判断出是缺少JAR包。这个JAR包,不是HBase自身缺少JAR包,而是因为安装了EsgynDB的环境缺少了EsgynDB的驱动包。
在安装EsgynDB的过程中,需要拷贝两个驱动包到hbase的lib目录下,根据对应的版本,驱动包名称为hbase-trx-cdh5_7-2.7.0.jar 及 trafodion-utility-2.7.0.jar。在升级之前,这两个驱动包会拷贝到/opt/cloudera/parcels/CDH-5.13.3-1.cdh5.13.3.p0.2/lib/hbase/lib下面。这两个驱动包对应的配置信息如下(HBase配置里面搜索transaction可找到),
但是升级之后,/opt/cloudera/parcels/CDH的软链接更新了,新的链接地址为:/opt/cloudera/parcels/CDH-5.16.2-1.cdh5.16.2.p0.8/lib/hbase/lib。检查后我们发现新的hbase的lib下面缺少这两个包,手动拷贝这两个驱动包到每个节点的对应目录下并重启HBase,恢复正常,现在的HBase实例中可以看到两个HBase Master的主备状态了,如下图所示。
————————————————
版权声明:本文为CSDN博主「post_yuan」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/post_yuan/article/details/102899573