HBase Installation

HBase Installation

基礎配置

基本訊息

  • OS: CentOS 6.5 64bit
  • HBase: hbase-1.2.0-cdh5.7.0
  • JDK: 8u144

Java的安裝與配置

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
[root@cdh001 ~]# cd /opt/software/
[root@cdh001 software]# ls
jdk-8u144-linux-x64.tar ## 已下載的JDK壓縮包
[root@cdh001 software]# mkdir -p /usr/java
[root@cdh001 software]# mv jdk-8u144-linux-x64.tar /usr/java
[root@cdh001 software]# cd /usr/java
[root@cdh001 java]# tar -vxf jdk-8u144-linux-x64.tar
[root@cdh001 java]# ll
drwxr-xr-x. 8 uucp 143 4096 Jul 22 13:11 jdk1.8.0_144
-rw-r--r--. 1 root root 377835520 Aug 20 22:13 jdk-8u144-linux-x64.tar
[root@cdh001 java]# chown -R root:root jdk1.8.0_144
[root@cdh001 java]# ll
drwxr-xr-x. 8 root root 4096 Jul 22 13:11 jdk1.8.0_144
-rw-r--r--. 1 root root 377835520 Aug 20 22:13 jdk-8u144-linux-x64.tar
[root@cdh001 java]# vim /etc/profile
## 新增下列兩行在文件中的任一位置,設置Java環境變量
export JAVA_HOME=/usr/java/jdk1.8.0_144
export PATH=$JAVA_HOME/bin:$PATH
[root@cdh001 java]# source /etc/profile
[root@cdh001 java]# which java ## 確認Java環境變量設置成功
/usr/java/jdk1.8.0_144/bin/java
[root@cdh001 java]# java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

HBase Installation

  • CDH HBase:
    • CDH HBase
    • Download hbase-1.2.0-cdh5.7.0.tar.gz
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[root@cdh001 ~]# ls
hbase-1.2.0-cdh5.7.0.tar.gz
[root@cdh001 ~]# tar -xvf hbase-1.2.0-cdh5.7.0.tar.gz -C /opt/software
[root@cdh001 ~]# cd /opt/software
[root@cdh001 software]# ln -s hive-1.1.0-cdh5.7.0 hbase
[root@cdh001 software]# vim /etc/profile
## 將owner變更成啟動HBase的user,以hadoop user為例
[root@cdh001 software]# chown -R hadoop:hadoop hive-1.1.0-cdh5.7.0
[root@cdh001 software]# chown -R hadoop:hadoop hbase
## 新增下列兩行在文件中的任一位置,設置HBase環境變量
export HBASE_HOME="/opt/software/hbase"
export PATH="$HBASE_HOME/bin:$PATH"
[root@cdh001 software]# source /etc/profile
# 確認HBase部署是否完成
[root@cdh001 software]# hbase version
HBase 1.2.0-cdh5.7.0
Source code repository file:///data/jenkins/workspace/generic-binary-tarball-and-maven-deploy/CDH5.7.0-Packaging-HBase-2016-03-23_11-28-41/hbase-1.2.0-cdh5.7.0 revision=Unknown
Compiled by jenkins on Wed Mar 23 11:46:29 PDT 2016
From source with checksum 91b52afd1a8dfc556696ed78433f5621

HBase Standalone Configuration

配置hbase-env.sh

1
2
3
4
5
6
7
8
9
10
11
[root@cdh001 ~]# cd $HBASE_HOME
[root@cdh001 hbase]# cd conf
[root@cdh001 conf]# vim hbase-env.sh
## 在文件中對應兩處進行設置
## ...
# The java implementation to use. Java 1.7+ required.
export JAVA_HOME=/usr/java/jdk1.8.0_144
## ...
# Tell HBase whether it should manage it's own instance of Zookeeper or not.
export HBASE_MANAGES_ZK=true

配置hbase-site.xml

1
2
3
4
5
6
7
[root@cdh001 conf]# vim hbase-site.xml
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///opt/software/hbase/data</value>
</property>
</configuration>

Start 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
## 切換到對應的user
[root@cdh001 conf]# su - hadoop
[hadoop@cdh001 ~]$ cd $HBASE_HOME/bin
[hadoop@cdh001 bin]$ start-hbase.sh
starting master, logging to /opt/software/hbase/logs/hbase-hadoop-master-cdh001.out
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
[hadoop@cdh001 bin]$ jps
4214 HMaster
4490 Jps
### 進入shell mode
[hadoop@cdh001 bin]$ hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.2.0-cdh5.7.0, rUnknown, Wed Mar 23 11:46:29 PDT 2016
hbase(main):001:0> status
1 active master, 0 backup masters, 1 servers, 2 dead, 2.0000 average load
hbase(main):002:0> exit
[hadoop@cdh001 bin]$ stop-hbase.sh
stopping hbase..................

Web UI

  • 透過IP:60010 訪問HBase的Web介面