一、安装准备
下载地址:http://archive.apache.org/dist/hbase/
HBase官方文档:http://hbase.apache.org/book.html
ssh免密登录:https://cloud.tencent.com/developer/article/1818611
zookeeper安装:https://cloud.tencent.com/developer/article/1818643
hadoop集群安装:https://cloud.tencent.com/developer/article/1818644
二、解压安装
1、解压文件
代码语言:javascript复制cd /usr/local/hadoop
tar zxpf hbase-2.1.0-bin.tar.gz
2、创建软链接
代码语言:javascript复制ln -s hbase-2.1.0 hbase
三、修改配置文件
regionservers
regionservers配置和hadoop的work一样,hadoop的DataNode节点是哪个regionservers就是哪几个
代码语言:javascript复制hadoop003
hadoop004
hadoop005
hbase-site.xml
代码语言:javascript复制 hbase.master
60000
hbase.tmp.dir
/home/data/cluster/hbase/tmp
hbase.rootdir
hdfs://ns1/hbase
hbase.cluster.distributed
true
hbase.zookeeper.property.clientPort
2181
hbase.zookeeper.quorum
hadoop001,hadoop002,hadoop003
hbase.zookeeper.property.dataDir
/usr/local/zookeeper/data
dfs.datanode.max.transfer.threads
4096
hbase.unsafe.stream.capability.enforce
false
hfile.format.version
3
hbase.superuser
hbase,admin,root,hdfs,zookeeper,hive,hadoop,hue,impala,spark,kylin
hbase.coprocessor.user.region.classes
org.locationtech.geomesa.hbase.coprocessor.GeoMesaCoprocessor
hbase.table.sanity.checks
false
hbase.coprocessor.abortonerror
false
hfile.block.cache.size
stofile的读缓存占用Heap的大小百分比。该值直接影响数据读的性能当然是越大越好,如果写比读少很多,开到0.4-0.5也没问题,如果读写均衡,设置为0.3左右。如果写比读多,果断使用默认就行。
hbase-env.sh
hbase环境变量配置
代码语言:javascript复制#!/usr/bin/env bash
export HBASE_OPTS="-XX: UseConcMarkSweepGC -verbose:gc -XX: PrintGCDetails -XX: PrintGCTimeStamps -Xloggc:/usr/local/hadoop/hbase/logs/jvm-gc-hbase.log"
export JAVA_HOME=/usr/java/jdk1.8
export HBASE_HEAPSIZE=4G
export HADOOP_HOME=/usr/local/hadoop/hadoop
export HBASE_HOME=/usr/local/hadoop/hbase
export HBASE_CLASSPATH=/usr/local/hadoop/hadoop/etc/hadoop
export HBASE_MANAGES_ZK=false
export HBASE_PID_DIR=/var/hadoop/pids
backup-masters
启动hbase时会将配置的backup-masters节点作为备用HMaster
代码语言:javascript复制hadoop001
hadoop002
四、环境变量配置
编辑 /etc/profile 文件
代码语言:javascript复制vim /etc/profile
添加一下内容
代码语言:javascript复制export HBASE_HOME=/usr/local/hadoop/hbase
export PATH=$PATH:$HBASE_HOME
五、启动hbase
代码语言:javascript复制start-hbase.sh
六、验证安装
1、执行shell命令
代码语言:javascript复制hbase shell
代码语言:javascript复制create 'tb1','cmf1','cmf2','cmf3'
list
list_namespace
2、访问web页面
http://hadoop001:16010/master-status
http://hadoop002:16010/master-status