org.apache.hadoop.hbase.DoNotRetryIOException: Compression algorithm 'snappy' previously failed test

一、问题:

在启动HBase replication功能后,有一个regionServer在启动时报错提示:

2018-01-16 14:07:43,308 INFO  [RS_OPEN_REGION-dashuju172:16020-0] coordination.ZkOpenRegionCoordination: Opening of region {ENCODED => 2c52b5a2d05ba1abe8503c904c1f54d9, NAME => 'iw:test11,,1516082862364.2c52b5a2d05ba1abe8503c904c1f54d9.', STARTKEY => '', ENDKEY => ''} failed, transitioning from OPENING to FAILED_OPEN in ZK, expecting version 4
2018-01-16 14:07:43,377 INFO  [PriorityRpcServer.handler=16,queue=0,port=16020] regionserver.RSRpcServices: Open iw:test11,,1516082862364.2c52b5a2d05ba1abe8503c904c1f54d9.
2018-01-16 14:07:43,398 ERROR [RS_OPEN_REGION-dashuju172:16020-1] handler.OpenRegionHandler: Failed open of region=iw:test11,,1516082862364.2c52b5a2d05ba1abe8503c904c1f54d9., starting to roll back the global memstore size.
org.apache.hadoop.hbase.DoNotRetryIOException: Compression algorithm 'snappy' previously failed test.
    at org.apache.hadoop.hbase.util.CompressionTest.testCompression(CompressionTest.java:91)
    at org.apache.hadoop.hbase.regionserver.HRegion.checkCompressionCodecs(HRegion.java:6300)
    at org.apache.hadoop.hbase.regionserver.HRegion.openHRegion(HRegion.java:6251)
    at org.apache.hadoop.hbase.regionserver.HRegion.openHRegion(HRegion.java:6218)
    at org.apache.hadoop.hbase.regionserver.HRegion.openHRegion(HRegion.java:6189)
    at org.apache.hadoop.hbase.regionserver.HRegion.openHRegion(HRegion.java:6145)
    at org.apache.hadoop.hbase.regionserver.HRegion.openHRegion(HRegion.java:6096)
    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:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

可以说修改配置到启动,压根没有触及SNAPPY的相关改动。试着恢复配置修改依旧出现上述情况。查阅HBase官方解释到由于SNAPPY的版本问题,需要额外的添加库,并设置环境变量:HBASE_LIBRARY_PATH。

二、解决步骤

1、查看支持

执行hadoop checknative,检查hadoop对snappy的支持:

18/11/19 14:34:38 INFO bzip2.Bzip2Factory: Successfully loaded & initialized native-bzip2 library system-native
18/11/19 14:34:38 INFO zlib.ZlibFactory: Successfully loaded & initialized native-zlib library
Native library checking:
hadoop:  true /data/installfiles/cloudera/parcels/CDH-5.7.2-1.cdh5.7.2.p0.18/lib/hadoop/lib/native/libhadoop.so.1.0.0
zlib:    true /lib64/libz.so.1
snappy:  true /data/installfiles/cloudera/parcels/CDH-5.7.2-1.cdh5.7.2.p0.18/lib/hadoop/lib/native/libsnappy.so.1
lz4:     true revision:10301
bzip2:   true /lib64/libbz2.so.1
openssl: true /usr/lib64/libcrypto.so

参看HBase官方设置环境变量

export HBASE_LIBRARY_PATH=/data/installfiles/cloudera/parcels/CDH-5.7.2-1.cdh5.7.2.p0.18/lib/hadoop/lib/native

重启HRegionServer,错误依旧存在。

2、检查环境变量

在启动HRegionServer时,观察到环境变量日志:

2018-11-19 00:53:06,568 INFO org.apache.hadoop.hbase.util.ServerCommandLine: env:LD_LIBRARY_PATH=:/data/installfiles/cloudera/parcels/CDH-5.7.2-1.cdh5.7.2.p0.18/lib/hadoop/lib/native:/opt/cloudera/parcels/CDH-5.7.2-1.cdh5.7.2.p0.18/lib/hbase/lib/native/Linux-amd64-64

并且在日志中并未发现HBASE_LIBRARY_PATH,检查发现/opt/cloudera/parcels/CDH-5.7.2-1.cdh5.7.2.p0.18/lib/hbase/lib/native/Linux-amd64-64并不存在,并且/usr/lib64目录存在libsnappy.so、libstdc++.so.6两个库,故在改目录下建立软连接

ln -s /usr/lib64 Linux-amd64-64

重启HRegionServer,问题解决。

    原文作者:凡尔Issac
    原文地址: https://www.jianshu.com/p/88747cfa28f7
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞