官网地址:http://hbase.apache.org/
文档地址:http://hbase.apache.org/book.html#quickstart
HBase单机版安装
环境
操作系统 :CentOS 7.6
Java版本:JDK 1.8
1、下载地址:
wget https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/2.2.7/hbase-2.2.7-bin.tar.gz
2、解压缩下载的文件,然后转到新创建的目录
tar xzvf hbase-2.2.7-bin.tar.gz
cd hbase-2.2.7
3、由于HBase依赖JAVA_HOME环境变量,所以要导入Java环境变量,编辑conf/hbase-env.sh文件,并取消注释以#export JAVA_HOME =开头的行,然后将其设置为Java安装路径。
vim conf/hbase-env.sh
export JAVA_HOME=/data/soft/jdk1.8.0_181/
4、编辑conf/hbase-site.xml,这是主要的HBase配置文件。这时,您需要在本地文件系统上指定HBase和ZooKeeper写入数据的目录并确认一些风险。默认情况下,在/tmp下创建一个新目录。许多服务器配置为在重新引导时删除/ tmp的内容,因此您应该将数据存储在其他位置。
hbase-site.xm内容如下:
<configuration>
<!-- hbase存放数据目录 -->
<property>
<name>hbase.rootdir</name>
<value>file:///opt/hbase-2.2.7/hbase</value>
</property>
<!-- ZooKeeper数据文件路径 -->
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/opt/hbase-2.2.7/zookeeper</value>
</property>
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
<description>
Controls whether HBase will check for stream capabilities (hflush/hsync).
Disable this if you intend to run on LocalFileSystem, denoted by a rootdir
with the 'file://' scheme, but be mindful of the NOTE below.
WARNING: Setting this to false blinds you to potential data loss and
inconsistent system state in the event of process and/or node failures. If
HBase is complaining of an inability to use hsync or hflush it's most
likely not a false positive.
</description>
</property>
</configuration>
到此,HBase单节点的配置就完成了
5、启动HBase
启动命令:./bin/start-hbase.sh
关闭命令:./bin/stop-hbase.sh
使用jps命令查看master是否启动成功
[root@localhost bin]# jps
12177 Jps
11869 HMaster
为了方便也可以将hbase也加入了环境变量中,方便使用,在/etc/profile文件中,增加一下内容
1 export HBASE_HOME=/usr/local/java/hbase-2.2.7
2 export PATH=$HBASE_HOME/bin:$PATH
使环境变量生效,命令:source /etc/profile
6、使用浏览器访问HBase的Web UI,地址:http://172.16.40.211:16010/master-status,(默认端口:16010)

网友评论