hbase集羣安裝配置


1、環境介紹

(1)IP 規劃
 hserver  192.168.0.130
hclient1  192.168.0.131
hclient2  192.168.0.132

(2)軟件版本
    OS:rhel6.3-x86_64
   JDK:jdk1.6.0_41
HADOOP:hadoop-1.1.1
 HBASE:hbase-0.94.5

2、Hbase安裝

下載地址:http://mirror.bit.edu.cn/apache/hbase/hbase-0.94.5/hbase-0.94.5.tar.gz
解壓安裝:$tar zvxf hbase-0.94.5.tar.gz
hadoop安裝目錄:/hadoop/hadoop-1.1.1
hbase安裝目錄:/hadoop/hbase-0.94.5

3、Hbase配置

(1)$vim hbase-env.sh
export JAVA_HOME=/hadoop/jdk1.6.0_41
export HBASE_CLASSPATH=/hadoop/hadoop-1.1.1
export HBASE_MANAGES_ZK=true

(2)$vim hbase-site.xml
<configuration>
  <property>
    <name>hbase.rootdir</name>
    <value>hdfs://hserver:9000/hadoop/hbase</value>
  </property>
  <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
  </property>
  <property>
    <name>hbase.zookeeper.quorum</name>
    <value>hserver,hclient1,hclient2</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/hadoop/zookeeper</value>
  </property>
</configuration>

(3)$vim regionservers
hclient1
hclient2

4、Hbase啓停
注意啓動順序:保證Hadoop已經正常啓動後,啓動 Hbase

啓動:$/bin/start-hbases

(1)server端jps查看進程
$jps

9800 Jps
4389 JobTracker
4116 NameNode
4297 SecondaryNameNode
9488 HQuorumPeer
9611 HMaster

(2)slave端jps查看進程
$jps

5359 Jps
2784 DataNode
5190 HRegionServer
2894 TaskTracker
5041 HQuorumPeer

5、Hbase 操作

(1)Web 方式
 Hbase Master 訪問地址  http://hserver:60010
Region Server 訪問地址  http://hclient1:60030

(2)Shell 方式
$ hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.94.5, r1443843, Fri Feb  8 05:51:25 UTC 2013

//查看所有表:list
hbase(main):001:0> list
TABLE                                                                                                             
0 row(s) in 0.4950 seconds

//創建表:create '表名稱', '列名稱1','列名稱2','列名稱N' 
hbase(main):011:0> create 'user','no','name'
0 row(s) in 1.0430 seconds

//添加記錄:put '表名稱', '行名稱', '列名稱:', '值'
hbase(main):015:0> put 'user','1','name','upgirl'
0 row(s) in 0.0100 seconds

//查看記錄:get '表名稱', '行名稱 
hbase(main):021:0> get 'user','1'
COLUMN                        CELL                                                                                
 name:                        timestamp=1362636502868, value=upgirl                                               
1 row(s) in 0.0150 seconds

//禁用表:disable '表名稱'
hbase(main):022:0> disable 'user'
0 row(s) in 2.0710 seconds

//刪除表:drop '表名稱'
hbase(main):023:0> drop 'user'
0 row(s) in 1.0490 seconds

hbase(main):024:0> list
TABLE                                                                                                             
0 row(s) in 0.0090 seconds

6、遇到的問題:
(1)jps查看slave節點,HRegionServer進程未啓動,hbase-hadoop-regionserver-hclient1.log日誌報錯
FATAL org.apache.hadoop.hbase.regionserver.HRegionServer: Master rejected startup because clock is out of sync
org.apache.hadoop.hbase.ClockOutOfSyncException: org.apache.hadoop.hbase.ClockOutOfSyncException: Server hclient1,60020,1362557838693 has been rejected; Reported time is too far out of sync with master.  Time difference of 43200339ms > max allowed of 30000ms

原因:時鐘不同步

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章