Hbase 1.2.5安装过程

1 下载和解压

1.1 下载
Hbase可以在Hadoop集群的某些机器(一台也可以,例如选择namenode节点来安装)上安装,也可以全部机器上都安装。Hbase是依赖Hadoop和Zookeeper的,所以在安装Hbase之前,请先安装Hadoop和Zookeeper。
在官网 http://mirror.bit.edu.cn/apache/hbase/stable/ 下载 hbase-1.2.5-bin.tar.gz,上传到目录/usr/local/hbase 下
1.2 解压缩
解压并删除安装包

tar hbase-1.2.5-bin.tar.gz
rm -rf hbase-1.2.5-bin.tar.gz

2 配置

2.1 环境变量配置

vim /etc/profile

添加:

export HBASE_HOME=/usr/local/hbase/hbase-1.2.5
export PATH=$PATH:$HBASE_HOME/bin
source /etc/profile

2.2 conf目录下的配置

cd /usr/local/hbase/hbase-1.2.5/conf/

(1)修改hbase-env.sh文件

vim hbase-env.sh

添加:

export JAVA_HOME=/usr/local/jdk/jdk1.8.0_181
export HADOOP_HOME=/usr/local/hadoop/hadoop-2.8.5
export HBASE_HOME=/usr/local/hbase/hbase-1.2.5
export HBASE_CLASSPATH=/usr/local/hadoop/hadoop-2.8.5/etc/hadoop
export HBASE_PID_DIR=/usr/local/hbase/hbase-1.2.5/pids
export HBASE_MANAGES_ZK=false

(2)修改配置文件hbase-site.xml

vim hbase-site.xml
<configuration>

<property>
 <name>hbase.rootdir</name>
 <value>hdfs://master:9000/hbase</value>
 <description>The directory shared byregion servers.</description>
</property>

<property>
 <name>hbase.zookeeper.property.clientPort</name>
 <value>2181</value>
 <description>Property from ZooKeeper'sconfig zoo.cfg. The port at which the clients will connect.
 </description>
</property>

<property>
 <name>zookeeper.session.timeout</name>
 <value>120000</value>
</property>

<property>
 <name>hbase.zookeeper.quorum</name>
 <value>master,slaver1,slaver2,slaver3,slaver4,slaver5</value>
</property>

<property>
 <name>hbase.tmp.dir</name>
 <value>/usr/local/hbase/hbase-1.2.5/tmp</value>
</property>

<property>
 <name>hbase.cluster.distributed</name>
 <value>true</value>
</property>

<property>
<name>hbase.master.info.port</name>
<value>60010</value>
</property>

</configuration>

(3)修改regionservers文件

vim regionservers

添加:

master
slaver1
slaver2
slaver3
slaver4
slaver5

3 启动和测试

3.1 启动
Hbase是基于hadoop提供的分布式文件系统的,所以启动Hbase之前,先确保hadoop在正常运行,另外Hbase还依赖于zookkeeper,本来我们可以用hbase自带的zookeeper,但是我们上面的配置启用的是我们自己的zookeeper集群,所以在启动hbase前,还要确保zokeeper已经正常运行。

cd /usr/local/hbase/hbase-1.2.5/bin/
./start-hbase.sh

在这里插入图片描述
查看master的进程:
在这里插入图片描述
3.2 测试
(1)用浏览器访问Hbase状态信息
访问地址 http://192.168.144.130:60010
(2)启动hbase的命令行
执行命令,进入到Hbase的bin目录内,命令是:

扫描二维码关注公众号,回复: 3713545 查看本文章
cd  /usr/local/hbase/hbase-1.2.5/bin/

执行命令启动Hbase命令行窗口,命令是:

./hbase  shell

出现:

[root@master bin]# hbase shell
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hbase/hbase-1.2.5/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hadoop/hadoop-2.8.5/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.2.5, rd7b05f79dee10e0ada614765bb354b93d615a157, Wed Mar  1 00:34:48 CST 2017

hbase(main):001:0> 

在这里插入图片描述

status

在这里插入图片描述

如果要退出Hbase命令行模式的话,输入:exit
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/Source_00/article/details/83022284