Hbase 2.1.5版本的单节点环境搭建及踩坑记录

一.下载及解压

1.1 直接去官网下载 我用的是2.1.5版本

下载链接  http://mirror.bit.edu.cn/apache/hbase/2.1.5/hbase-2.1.5-bin.tar.gz

Hbase 2.1.5版本的单节点环境搭建及踩坑记录_第1张图片Hbase 2.1.5版本的单节点环境搭建及踩坑记录_第2张图片

 2.1+版本的HBase 需要最少 1.8版本的JDK  至于Hadoop版本看图就很明了

1.2 上传解压

tar -zxvf hbase-2.1.5-bin.tar.gz -C /opt/modules/

二.配置

2.1修改环境文件 hbase-env.sh

export JAVA_HOME=/opt/modules/jdk1.8.0_131
export HBASE_MANAGES_ZK=false 
export HBASE_HOME=/opt/modules/hbase-2.1.5
export HADOOP_HOME=/opt/modules/hadoop-3.1.2
export HBASE_OPTS="$HBASE_OPTS -XX:+UseConcMarkSweepGC"

设置 JAVA_HOME 为自己安装的版本

设置 HBASE_MANAGES_ZK 为false(默认为true),即不使用hbase自带的zk

2.2修改配置文件 hbase-site.xml


    
      hbase.rootdir
      hdfs://lx:9000/hbase
  
  
    hbase.cluster.distributed
    true
  
  
    dfs.replication
    1
  
  
    hbase.tmp.dir
    /opt/modules/hbase-2.1.5/tmp
  
  
    hbase.zookeeper.quorum
    lx
  
  
    hbase.zookeeper.property.clientPort
    2181
  
  
     hbase.unsafe.stream.capability.enforce
     false
  
  
  
     hbase.wal.provider
     filesystem
  
  
     zookeeper.session.timeout
     90000
  
  
     hbase.regionserver.restart.on.zk.expire
     true
  

2.3 配置regionservers

编辑regionservers文件,文件内容默认为localhost,此处配置自己的主机名,如hadoop.master等。

2.4.启动HBase

start-hbase.sh

浏览器输入:http://lx:16010/  查看web页面(16010是2.0+版本的默认端口,1.0+版本是60010)

三:踩坑记录

3.1报错java.lang.NoClassDefFoundError: org/apache/htrace/SamplerBuilder

如果HMaster未启动或启动后又关闭,我们可以查看日志出现以下错误:java.lang.NoClassDefFoundError: org/apache/htrace/SamplerBuilder,说明是缺少jar包 将/lib/client-facing-thirdparty/htrace-core-3.1.0-incubating.jar 复制到/lib目录下

2019-08-21 14:29:48,231 INFO  [main] hfile.CacheConfig: Created cacheConfig: CacheConfig:disabled
2019-08-21 14:29:48,603 ERROR [main] regionserver.HRegionServer: Failed construction RegionServer
java.lang.NoClassDefFoundError: org/apache/htrace/SamplerBuilder
        at org.apache.hadoop.hdfs.DFSClient.(DFSClient.java:644)
        at org.apache.hadoop.hdfs.DFSClient.(DFSClient.java:628)
        at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:149)
        at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2667)
        at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:93)
        at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2701)
        at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2683)
        at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:372)
        at org.apache.hadoop.fs.Path.getFileSystem(Path.java:295)
        at org.apache.hadoop.hbase.util.CommonFSUtils.getRootDir(CommonFSUtils.java:362)
        at org.apache.hadoop.hbase.util.CommonFSUtils.isValidWALRootDir(CommonFSUtils.java:412)
        at org.apache.hadoop.hbase.util.CommonFSUtils.getWALRootDir(CommonFSUtils.java:388)
        at org.apache.hadoop.hbase.regionserver.HRegionServer.initializeFileSystem(HRegionServer.java:704)
        at org.apache.hadoop.hbase.regionserver.HRegionServer.(HRegionServer.java:613)
        at org.apache.hadoop.hbase.master.HMaster.(HMaster.java:492)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.apache.hadoop.hbase.master.HMaster.constructMaster(HMaster.java:3099)
        at org.apache.hadoop.hbase.master.HMasterCommandLine.startMaster(HMasterCommandLine.java:236)
        at org.apache.hadoop.hbase.master.HMasterCommandLine.run(HMasterCommandLine.java:140)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
        at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:149)
        at org.apache.hadoop.hbase.master.HMaster.main(HMaster.java:3117)
Caused by: java.lang.ClassNotFoundException: org.apache.htrace.SamplerBuilder
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 25 more
2019-08-21 14:29:48,606 ERROR [main] master.HMasterCommandLine: Master exiting
java.lang.RuntimeException: Failed construction of Master: class org.apache.hadoop.hbase.master.HMaster. 
        at org.apache.hadoop.hbase.master.HMaster.constructMaster(HMaster.java:3106)
        at org.apache.hadoop.hbase.master.HMasterCommandLine.startMaster(HMasterCommandLine.java:236)
        at org.apache.hadoop.hbase.master.HMasterCommandLine.run(HMasterCommandLine.java:140)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
        at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:149)
        at org.apache.hadoop.hbase.master.HMaster.main(HMaster.java:3117)

在HBase的安装目录下执行

cp /lib/client-facing-thirdparty/htrace-core-3.1.0-incubating.jar ../../lib

PS:这里插一句 官方的2.1.4的包简直是神了 在目录下只有htrace-core4-4.2.0-incubating.jar 而没有htrace-core-3.1.0-incubating.jar

无奈之下我只好下了个2.1.5的版本....

3.2报错java.lang.IllegalStateException:

java.lang.IllegalStateException: The procedure WAL relies on the ability to hsync for proper operation during component failures, but the underlying filesystem does not support doing so. Please check the config value of 'hbase.procedure.store.wal.use.hsync' to set the desired level of robustness and ensure the config value of 'hbase.wal.dir' points to a FileSystem mount that can provide it.
        at org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore.rollWriter(WALProcedureStore.java:1086)
        at org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore.recoverLease(WALProcedureStore.java:423)
        at org.apache.hadoop.hbase.procedure2.ProcedureExecutor.init(ProcedureExecutor.java:611)
        at org.apache.hadoop.hbase.master.HMaster.createProcedureExecutor(HMaster.java:1461)
        at org.apache.hadoop.hbase.master.HMaster.finishActiveMasterInitialization(HMaster.java:893)
        at org.apache.hadoop.hbase.master.HMaster.startActiveMasterManager(HMaster.java:2275)
        at org.apache.hadoop.hbase.master.HMaster.lambda$run$0(HMaster.java:584)
        at java.lang.Thread.run(Thread.java:748)
2019-08-21 14:33:07,360 ERROR [master/lx:16000:becomeActiveMaster] master.HMaster: ***** ABORTING master lx,16000,1566369174329: Unhandled exception. Starting shutdown. *****
java.lang.IllegalStateException: The procedure WAL relies on the ability to hsync for proper operation during component failures, but the underlying filesystem does not support doing so. Please check the config value of 'hbase.procedure.store.wal.use.hsync' to set the desired level of robustness and ensure the config value of 'hbase.wal.dir' points to a FileSystem mount that can provide it.
        at org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore.rollWriter(WALProcedureStore.java:1086)
        at org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore.recoverLease(WALProcedureStore.java:423)
        at org.apache.hadoop.hbase.procedure2.ProcedureExecutor.init(ProcedureExecutor.java:611)
        at org.apache.hadoop.hbase.master.HMaster.createProcedureExecutor(HMaster.java:1461)
        at org.apache.hadoop.hbase.master.HMaster.finishActiveMasterInitialization(HMaster.java:893)
        at org.apache.hadoop.hbase.master.HMaster.startActiveMasterManager(HMaster.java:2275)
        at org.apache.hadoop.hbase.master.HMaster.lambda$run$0(HMaster.java:584)
        at java.lang.Thread.run(Thread.java:748)
2019-08-21 14:33:07,361 INFO  [master/lx:16000:becomeActiveMaster] regionserver.HRegionServer: ***** STOPPING region server 'lx,16000,1566369174329' *****
2019-08-21 14:33:07,361 INFO  [master/lx:16000:becomeActiveMaster] regionserver.HRegionServer: STOPPED: Stopped by master/lx:16000:becomeActiveMaster
2019-08-21 14:33:07,964 INFO  [master/lx:16000.splitLogManager..Chore.1] hbase.ScheduledChore: Chore: SplitLogManager Timeout Monitor was stopped
2019-08-21 14:33:09,516 INFO  [master/lx:16000] ipc.NettyRpcServer: Stopping server on /192.168.153.131:16000
2019-08-21 14:33:09,769 WARN  [master/lx:16000] regionserver.HRegionServer: Initialize abort timeout task failed
java.lang.IllegalAccessException: Class org.apache.hadoop.hbase.regionserver.HRegionServer can not access a member of class org.apache.hadoop.hbase.regionserver.HRegionServer$SystemExitWhenAbortTimeout with modifiers "private"
        at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102)
        at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:296)
        at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:288)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:413)
        at org.apache.hadoop.hbase.regionserver.HRegionServer.run(HRegionServer.java:1044)
        at org.apache.hadoop.hbase.master.HMaster.run(HMaster.java:598)
        at java.lang.Thread.run(Thread.java:748)

解决方法: 在 配置文件 hbase-site.xml  增加以下配置

 
     hbase.unsafe.stream.capability.enforce
     false
 

再次启动 start-hbase.sh 即可

Hbase 2.1.5版本的单节点环境搭建及踩坑记录_第3张图片

Hbase 2.1.5版本的单节点环境搭建及踩坑记录_第4张图片

 

你可能感兴趣的:(环境)