标签:value col red font stat nbsp bin 观察 region
说明:Hbase部署模式有以下三种
(1)本地模式:本地模式不依赖于HDFS存储,将文件存储到操作系统本地目录,好处是我们不需要搭建HDFS集群,即可学些HBase相关命令及客户端操作。
(2)伪分布模式:一台机器完成Hbase所有组件的配置,需要依赖HDFS分布式存储
(3)全分布模式:多机部署,一般情况下Hmaster和HregionServer分布在不同的服务器,需要依赖底层HDFS分布式存储。
一、安装介质
http://archive.apache.org/dist/hbase
hbase-0.96.2-hadoop2-bin.tar.gz
二、安装JDK
[root@hadoop-server01 bin]# mkdir -p /usr/local/apps
[root@hadoop-server01 bin]# ll /usr/local/apps/
total 4
drwxr-xr-x. 8 uucp 143 4096 Apr 10 2015 jdk1.7.0_80
[root@hadoop-server01 bin]# pwd
/usr/local/apps/jdk1.7.0_80/bin
[root@hadoop-server01 bin]#vi /etc/profile
export JAVA_HOME=/usr/local/apps/jdk1.7.0_80
export PATH=$PATH:$JAVA_HOME/bin
[root@hadoop-server01 bin]# source /etc/profile
三、上传安装包并解压
1、上传hbase-0.96.2-hadoop2-bin.tar.gz安装包到服务器
2、解压安装包
[root@hadoop-server01 ~]# tar -xvf hbase-0.96.2-hadoop2-bin.tar.gz -C /apps/hbase/
四、修改配置文件
[root@hadoop-server01 conf]# cd /apps/hbase/hbase-0.96.2-hadoop2/conf
1、修改hbase-env.sh
# The java implementation to use. Java 1.6 required.
# export JAVA_HOME=/usr/java/jdk1.6.0/
export JAVA_HOME=/usr/local/apps/jdk1.7.0_80
# Extra Java CLASSPATH elements. Optional.
2、修改hbase-site.xml
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///apps/hbase/hbase-0.96.2-hadoop2/data</value>
</property>
</configuration>
对于HBase的本地模式,只需要配置数据保存目录即可,数据保存在操作系统本地目录
[root@hadoop-server01 data]# mkdir -p /apps/hbase/hbase-0.96.2-hadoop2/data
五、启动HBase服务
starting master, logging to /apps/hbase/hbase-0.96.2-hadoop2/logs/hbase-root-master-hadoop-server01.out
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/apps/hbase/hbase-0.96.2-hadoop2/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/apps/hadoop-2.4.1/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
通过日志可以看出,本地模式下只运行HMaster服务
[root@hadoop-server01 bin]# jps | grep -v Jps
3723 HMaster
通过jps命令查看确实也只有HMster服务
六、测试验证
[root@hadoop-server01 ~]# hbase shell
2018-08-11 00:44:55,914 INFO [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.96.2-hadoop2, r1581096, Mon Mar 24 16:03:18 PDT 2014
如上日志,能正常访问Hbase Shell,说明本地模式安装成功,下面创建表来查看数据是否存在指定的本地目录
hbase(main):001:0> create 'Fruit','Apple','Pairs','Banana'
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/apps/hbase/hbase-0.96.2-hadoop2/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/apps/hadoop-2.4.1/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
0 row(s) in 0.9450 seconds
=> Hbase::Table - Fruit
hbase(main):002:0>
表创建成功
观察目录/apps/hbase/hbase-0.96.2-hadoop2/data/data/default下是否有我们创建的表
[root@hadoop-server01 default]# ll /apps/hbase/hbase-0.96.2-hadoop2/data/data/default
total 4
drwxr-xr-x. 5 root root 4096 Aug 11 00:47 Fruit
如上,我们创建的表以文件夹的形式存放在了操作系统本地目录/apps/hbase/hbase-0.96.2-hadoop2/data/data/default下,说明配置的本地目录没有问题。
到此,HBase的本地模式搭建成功。
标签:value col red font stat nbsp bin 观察 region
原文地址:http://blog.51cto.com/2951890/2158305