hbase安裝html
下載 wget http://apache.gree.com/apache/hbase/hbase-1.2.11/hbase-1.2.11-bin.tar.gzjava
tar -zxvf base-1.2.11-bin.tar.gz -C /usr/local/shell
mv /ussr/local/hbase-1.2.11 /usr/local/hbaseapache
配置環境服務器
vi /etc/profilessh
export HBASE_HOME=/usr/local/hbase分佈式
export PATH=$HBASE_HOME/bin:$PATHoop
保存退出測試
source /etc/profilespa
編輯HBASE_HOME/conf/hbase-env.sh,添加
export JAVA_HOME=/usr/java/jdk1.8.0_191-amd64/jre
export HBASE_CLASSPATH=/usr/local/hadoop/conf
export HBASE_MANAGES_ZK=false 不使用hbase自帶的zookeeper,使用外部的zookeeper管理hbase
編輯 HBASE_HOME/conf/hbase-site.xml
<configuration> <property> <!--設置hbasemaster的主機和端口--> <name>hbase.master</name> <value>HDP-master:60000</value> </property> <property> <!-- 設置hbase在HDFS上的存儲路徑,要與hadoop的core-site.xml中的fs.defaultFS路徑一致 --> <name>hbase.rootdir</name> <value>hdfs://HDP-master:9000/hbase</value> </property> <property> <!-- 指定hbase是分佈式的 --> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property> <!-- 指定外部zookeeper地址,多個用‘,’分隔 --> <name>hbase.zookeeper.quorum</name> <value>HDP-master,HDP-slave1,HDP-slave2</value> </property> </configuration>
編輯HBASE_HOME/conf/regionservers ,設置hbase的從節點(安裝regionserver的節點)添加
HDP-slave1
HDP-slave2
退出保存
hbase集羣之間要進行數據同步,除了要配置ssh免密鏈接以外,還要保證各個服務器的時間一致,因此要配置時間同步
選定一個服務器,將其時間設置爲標準時間,進行配置
主服務器 編輯 /etc/chrony.conf 添加
allow 10.2.14.0/24 設置容許哪些網段的機器同步本機時間
local stratum 10 不去同步任何機器的時間,設置時間同步服務器級別
保存退出
systemctl restart chronyd
從服務器 編輯/etc/chrony.conf
將
server 0.rhel.pool.ntp.org.iburst
...
server 4.rhel.pool.ntp.org iburst
修改成:
server 10.2.xxx.xx iburst ip爲主服務器的IP,設置同步時間的源服務器
保存退出
重啓chronyd
systemctl restart chronyd
測試,可經過指令查看各機器時間
watch -n 1 date
更正主服務器時間
date -s 10/24/2019
date -s 17:23:22
要啓動hbase,須要先依次啓動zookeeper,hadoop
啓動zookeeper,集羣中每臺機子都須要執行
zookeeper/bin/zkServer.sh start
zookeeper/bin/zkServer.sh status
啓動hadoop(僅需在主節點執行)
sbin/start-all.sh
啓動hbase(僅需在主節點執行)
/usr/local/hbase/bin/start-hbase.sh
hbase啓動後在master用jps查看時是 HMaster ,在slave上是HRegionServer進程
在命令行 執行hbase shell便可以進入hbase的shell
list 列出全部的hbase表
describe table_name 查看錶結構
scan table_name 遍歷表中的數據
get table_name, rowkey 查看錶中主鍵爲rowkey的一行數據
get table_nmae,rowkey,column:qualifier 查看錶中指定行,指定列簇的指定列的值
get table_name,rowkey,{COLUMN => 'colum_name',TIMESTAMP => 15555699956861,FILTER =>"QualifierFilter(=, 'binary:Gil/0/31')"} 查看錶中指定rowkey指定列簇中符合條件的列的數據