1.安装Hbase


1)下载,注意要与hadoop版本兼容,且选择稳定版较好


wget http://mirrors.hust.edu.cn/apache/hbase/hbase-0.98.5/hbase-0.98.5-hadoop2-bin.tar.gz


2)解压 


tar -zxvf hbase-0.98.5-hadoop2-bin.tar.gz 



3)修改conf/hbase-site.xml文件 

<property>
  <name>hbase.rootdir</name>
  <value>hdfs://MasterServer:9000/hbase</value>
 </property>
 <property>
   <name>hbase.cluster.distributed</name>
   <value>true</value> 
 </property>
 <property>
   <name>hbase.master</name>
   <value>hdfs://MasterServer:60000</value>
 </property>
   <property>
    <name>hbase.zookeeper.quorum</name>
    <value>hadoop1,hadoop2,hadoop3</value>
  </property>


4)修改conf/regionservers文件 


MasterServer

SlaveServer


注:如果不想将MasterServer作为HRegionServer,就去掉MasterServer



5)修改conf/hbase-env.sh文件


export JAVA_HOME=/usr/lib/jvm/jdk1.6/jdk1.6.0_27

export HBASE_MANAGES_ZK=false  #启动指定的ZooKeeper,而非自带的ZooKeeper。

export HBASE_HOME=/home/hadooper/hadoop/hbase-0.98.5

export HADOOP_HOME=/home/hadooper/hadoop/hadoop-2.5.1



4.将配置好的hbase复制到其它节点

scp -r hbase-0.98.5 hadooper@SlaveServer:~/hadoop/




5.进入hbase shell


bin/hbase shell

HBase Shell; enter 'help<RETURN>' for list of supported commands.

Type "exit<RETURN>" to leave the HBase Shell

Version 0.98.5-hadoop2, rUnknown, Mon Aug  4 23:58:06 PDT 2014



查看集群状态


hbase(main):001:0> status


建表测试

hbase(main):002:0> create 'test','id'
0 row(s) in 1.3530 seconds
=> Hbase::Table - test
hbase(main):003:0> list
TABLE                                                                                             
member                                                                                            
test                                                                                              
2 row(s) in 0.0430 seconds
=> ["member", "test"]