Hbase(2.5.6)

ip 部署服务 端口
IP4 hbase(master) 【HMaster】 60010:HMaster的RPC通信,与其他HBase组件(如HRegionServer)进行交互,执行诸如分配Region、启动/停止RegionServer等管理任务
HRegionServer 16020:用于HRegionServer的RPC通信,执行读写操作以及其他与RegionServer相关的任务
IP5 hbase(master) 【HMaster】 60010:HMaster的RPC通信,与其他HBase组件(如HRegionServer)进行交互,执行诸如分配Region、启动/停止RegionServer等管理任务
HRegionServer 16020:用于HRegionServer的RPC通信,执行读写操作以及其他与RegionServer相关的任务
IP6 HRegionServer 16020:用于HRegionServer的RPC通信,执行读写操作以及其他与RegionServer相关的任务
IP7 HRegionServer 16020:用于HRegionServer的RPC通信,执行读写操作以及其他与RegionServer相关的任务

解压安装包到指定目录【storageServer1主机执行】

1
tar -zxvf hbase-2.5.6-bin.tar.gz

进入根目录

修改配置文件 hbase-env.sh【storageServer1主机执行】

在HBase安装目录下的conf目录,执行“vi hbase-env.sh”命令编辑HBase配置文件hbase-env.sh,配置HBase运行时的相关参数。

1
vim conf/hbase-env.sh
1
2
3
4
5
6
# 指定JDK安装目录,看具体项目部署位置。
export JAVA_HOME=/data/jdk1.8.0_231
#指定不使用内置的ZooKeeper
export HBASE_MANAGES_ZK=false
#防止jar包冲突
export HBASE_DISABLE_HADOOP_CLASSPATH_LOOKUP="true"

修改配置文件hbase-site.xml【storageServer1主机执行】

在HBase安装目录下的conf目录,执行“vi hbase-site.xml”命令编辑HBase配置文件hbase-site.xml,配置HBase相关参数。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<configuration>
<!--
The following properties are set for running HBase as a single process on a
developer workstation. With this configuration, HBase is running in
"stand-alone" mode and without a distributed file system. In this mode, and
without further configuration, HBase and ZooKeeper data are stored on the
local filesystem, in a path under the value configured for `hbase.tmp.dir`.
This value is overridden from its default value of `/tmp` because many
systems clean `/tmp` on a regular basis. Instead, it points to a path within
this HBase installation directory.

Running against the `LocalFileSystem`, as opposed to a distributed
filesystem, runs the risk of data integrity issues and data loss. Normally
HBase will refuse to run in such an environment. Setting
`hbase.unsafe.stream.capability.enforce` to `false` overrides this behavior,
permitting operation. This configuration is for the developer workstation
only and __should not be used in production!__

See also https://hbase.apache.org/book.html#standalone_dist
-->
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>queryServer1,queryServer2,queryServer3</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/data/zookeeper/tmp/data</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>hdfs://mycluster/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<!-- 开启配置防止 hmaster 启动问题 -->
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
</property>
<property>
<name>hbase.master.port</name>
<value>61000</value>
</property>

<!--hbase的web页面-->
<property>
<name>hbase.master.info.port</name>
<value>60010</value>
</property>
</configuration>

拷贝hadoop hdfs-site.xml文件【storageServer1主机执行】

1
cp /data/hadoop-3.3.0/etc/hadoop/hdfs-site.xml /data/hbase-2.5.6/conf/

修改配置文件regionservers【storageServer1主机执行】

在HBase安装目录下的conf目录,执行“vi regionservers”命令编辑HBase配置文件regionservers,配置运行HRegionServer所在的服务器主机名。

1
2
3
4
storageServer1
storageServer2
storageServer3
storageServer4

将配置好的Hbase分发到其他机器(具体看服务器环境分发,此处使用scp)

1
scp -r /data/hbase-2.5.6 app@ip:/data/

分发、刷新环境变量(每台机器都需要)

1
2
3
#HBASE_HOME
export HBASE_HOME=/data/hbase-2.5.6
export PATH=$PATH:$HBASE_HOME/bin
1
source /etc/profile

授权用户,切换用户,并启动hbase(每台机器都需要执行目录授权)

非必要不使用root账户,此处使用app账户进行测试

1
2
3
#授权文件路径
chown -R app:app /data/hbase-2.5.6
su app

启动hbase(只需要storageServer1 master启动)

1
2
3
4
# bin路径
cd bin
./start-hbase.sh

hbase master关闭命令

1
hbase-daemon.sh stop master

启动后可以使用hbase shell进行节点查看(1 master 1 back master 4 server)

image.png

验证:查看hbase web

http://IP4:60010/master-status