1.首先從官網上下載http://mirror.bit.edu.cn/apache/hbase/hbase-1.0.1/hbase-1.0.1-bin.tar.gz 安裝包 html
2.解壓縮到安裝目錄,tar -xvf hbase-1.0.1-bin.tar.gz java
3.修改conf/hbase-site.xml shell
<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,添加 apache
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 app
4.首先啓動hdoop,而後再啓動hbase 分佈式
>cd hbase-1.0.1/bin/ >./start-hbase.sh >./stop-hbase.sh
5.jps查看相關進程,應該有以下進程(若是出錯,請去logs目錄下查找相應錯誤),特別注意HMaster是否啓動成功 oop
13764 HRegionServer 4539 NameNode 19860 Jps 18087 HQuorumPeer 18298 HRegionServer 4996 ResourceManager 18177 HMaster 4839 SecondaryNameNode 4650 DataNode 5108 NodeManager
6.啓動hbase shell(最好配置PATH) ui
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>
啓動成功. spa