柚子快報邀請碼778899分享:Hbase安裝指引
柚子快報邀請碼778899分享:Hbase安裝指引
一、Linux版下安裝單機版hbase
1、下載hbase
地址:Apache HBase – Apache HBase Downloads
2、Hbase安裝
? ?##解壓hbase 到opt/module目錄
??[atguigu@hadoop105 ~]?tar -zxvf hbase-2.4.15-bin.tar
??## 修改文件名
??[atguigu@hadoop105 ~] mv hbase-2.4.15?hbase
3、配置hbase-env.sh文件(路徑:opt/module/hbase/conf/)
? ## 添加jdk環(huán)境
export JAVA_HOME=/usr/local/jdk1.8.0_241?
? ## 使用HBase內(nèi)置?ZooKeeper?
export HBASE_MANAGES_ZK=true
4、配置hbase-site.xml文件(路徑:opt/module/hbase/conf/)
??
????
????
??
??
????
????
??
????
????
????
??
??
????
????
??
??
????
????
??
??
????
????
??
??
????
????
??
??
????
????
??
??
????
????
??
5、配置regionservers文件(路徑:opt/module/hbase/conf/)
# 主機名
hadoop105
6、配置環(huán)境變量
[atguigu@hadoop105 ~]?vi ?/etc/profile
添加
export HBASE_HOME=/opt/module/hbase
export PATH=$PATH:$HBASE_HOME/bin
使用 source 讓配置的環(huán)境變量生效
[atguigu@hadoop105 ~]?source ?/etc/profile
7、配置hosts文件
[atguigu@hadoop105 ~]?vi ?/etc/hosts
添加 <主機ip> <主機名>??例子:192.168.1.8 ?hadoop105
修改hosts文件 刷新DNS
[atguigu@hadoop105 ~]?/etc/init.d/network restart
8、啟動hbase命令
[atguigu@hadoop105 ~] cd /opt/module/hbase/bin
[atguigu@hadoop105 ~]?./start-hbase.sh
9、啟動hbase shell 腳本命令
[atguigu@hadoop105 ~] cd /opt/module/hbase/bin
[atguigu@hadoop105 ~]?./hbase shell
?
10、shell腳本語句
##創(chuàng)建命名空間
hbase:001:0> create_namespace 'binlog'
##創(chuàng)建列族
hbase:001:0> create 'binlog:student','info'
##添加數(shù)據(jù)
hbase:001:0> put 'binlog:student','1001','info:name','roma'
hbase:001:0> put 'binlog:student','1001','info:sex','male'
hbase:001:0> put 'binlog:student','1001','info:age','18'
?
二、Linux版下安裝phoenix插件
1、下載地址:Phoenix Downloads | Apache Phoenix
2、phoenix安裝
? ##解壓phoenix到opt/module目錄
??[atguigu@hadoop105 ~]?tar -zxvf phoenix-hbase-2.4-5.1.2-bin.tar.gz
??## 修改文件名
??[atguigu@hadoop105 ~] mv?-zxvf phoenix-hbase-2.4-5.1.2-bin.tar.gz??phoenix
3、配置環(huán)境變量
[atguigu@hadoop105 ~]?vi ?/etc/profile
添加
export PHOENIX_HOME=/opt/module/phoenix
export PHOENIX_CLASSPATH=$PHOENIX_HOME
export PATH=$PATH:$PHOENIX_HOME/bin
使用 source 讓配置的環(huán)境變量生效
[atguigu@hadoop105 ~]?source ?/etc/profile
4、將下載的phoenix目錄下的架包放到Hbase安裝目錄下的lib
[atguigu@hadoop105 ~] cp phoenix-server-hbase-2.4-5.1.2.jar
/opt/module/hbase/lib/
5、將hbase的配置文件hbase-site.xml放到phoenix安裝目錄下的bin目錄
[atguigu@hadoop105 ~] cp /opt/module/hbase/conf/hbase-site.xml
/opt/module/phoenix/bin/
6、重啟hbase
[atguigu@hadoop105 ~] cd /opt/module/hbase/bin
[atguigu@hadoop105 ~]?./stop-hbase.sh
[atguigu@hadoop105 ~]?./start-hbase.sh
7、驗證phoenix安裝是否成功
[atguigu@hadoop105 ~] cd /opt/module/phoenix/bin
[atguigu@hadoop105 ~]?./sqlline.py
8、phoenix表映射
##創(chuàng)建命名空間
jdbc:phoenix>CREATE SCHEMA IF NOT EXISTS "binlog";
##映射hbase 表
jdbc:phoenix>CREATE TABLE "binlog"."student"(
??"ROW" varchar primary key,
??"info"."age" varchar,
??"info"."name" varchar,
??"info"."sex" varchar
) column_encoded_bytes=0; ?//禁用列映射
柚子快報邀請碼778899分享:Hbase安裝指引
參考閱讀
本文內(nèi)容根據(jù)網(wǎng)絡資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點和立場。
轉載請注明,如有侵權,聯(lián)系刪除。