1.首先从官网上下载http://mirror.bit.edu.cn/apache/hbase/hbase-1.0.1/hbase-1.0.1-bin.tar.gz 安装包
2.解压缩到安装目录,tar -xvf hbase-1.0.1-bin.tar.gz
3.修改conf/hbase-site.xml
<configuration>
<name>hbase.rootdir</name>
<property>
<!--这里的8020端口和hadoop中的core-site.xml中的hdfs端口相同-->
<value>hdfs://192.168.233.11:8020/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<!--使用本地zookeeper-->
<name>hbase.zookeeper.quorum</name>
<value>192.168.233.11</value>
</property>
<property>
<name>hbase.tmp.dir</name>
<value>/usr/hbase-1.0.1/tmp</value>
</property>
</configuration>
3.修改hbase-env.sh,添加
export JAVA_HOME=/usr/java/jdk1.7.0_75/
export HBASE_CLASSPATH=/usr/hbase-1.0.1/conf
export HBASE_MANAGES_ZK=true
注意:一个分布式运行的HBase依赖一个zookeeper集群。所有的节点和客户端都必须能够访问zookeeper。默认的情况下HBase会管理一个zookeep集群。这个集群会随着HBase的启动而启动。当然,你也可以自己管理一个zookeeper集群,但需要配置HBase。你需要修改conf/hbase-env.sh里面的HBASE_MANAGES_ZK 来切换。这个值默认是true的,作用是让HBase启动的时候同时也启动zookeeper
4.首先启动hdoop,然后再启动hbase
>cd hbase-1.0.1/bin/
>./start-hbase.sh
>./stop-hbase.sh
5.jps查看相关进程,应该有如下进程(如果出错,请去logs目录下查找相应错误),特别注意HMaster是否启动成功
13764 HRegionServer
4539 NameNode
19860 Jps
18087 HQuorumPeer
18298 HRegionServer
4996 ResourceManager
18177 HMaster
4839 SecondaryNameNode
4650 DataNode
5108 NodeManager
6.启动hbase shell(最好配置PATH)
hbase shell
hadoop@slave01:/usr/hbase-1.0.1/bin> ./hbase shell
2015-05-11 06:02:27,925 WARN [main] conf.Configuration: bad conf file: element not <property>
2015-05-11 06:02:30,720 WARN [main] conf.Configuration: bad conf file: element not <property>
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/hbase-1.0.1/lib/slf4j-log4j12-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hadoop-2.6.0/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
2015-05-11 06:02:31,268 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
2015-05-11 06:02:31,594 WARN [main] conf.Configuration: bad conf file: element not <property>
2015-05-11 06:02:31,804 WARN [main] conf.Configuration: bad conf file: element not <property>
2015-05-11 06:02:32,217 WARN [main] conf.Configuration: bad conf file: element not <property>
2015-05-11 06:02:32,438 WARN [main] conf.Configuration: bad conf file: element not <property>
2015-05-11 06:02:33,300 WARN [main] conf.Configuration: bad conf file: element not <property>
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.0.1, r66a93c09df3b12ff7b86c39bc8475c60e15af82d, Fri Apr 17 22:14:06 PDT 2015
hbase(main):001:0> list
TABLE
0 row(s) in 0.4370 seconds
=> []
hbase(main):002:0>
启动成功.