单机部署

[hadoop@hadoop004 software]$ wget http://archive.cloudera.com/cdh5/cdh/5/hbase-1.2.0-cdh5.12.0.tar.gz

[hadoop@hadoop004 software]$ tar -zxf hbase-1.2.0-cdh5.12.0.tar.gz -C ~/app/

[hadoop@hadoop004 software]$ cd ~/app/hbase-1.2.0-cdh5.12.0/
[hadoop@hadoop004 conf]$ vim hbase-env.sh

export JAVA_HOME=/usr/java/jdk1.8.0_144/
[hadoop@hadoop004 hbase-1.2.0-cdh5.12.0]$ mkdir -p tmp/hbasedata

[hadoop@hadoop004 hbase-1.2.0-cdh5.12.0]$ mkdir -p tmp/zkdata
<!--[hadoop@hadoop004 conf]$ vim hbase-site.xml-->

<configuration>
  <property>
    <name>hbase.rootdir</name>
    <value>file:///home/hadoop/app/hbase-1.2.0-cdh5.12.0/hbasedata</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/home/hadoop/app/hbase-1.2.0-cdh5.12.0/zkdata</value>
  </property>
  <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
  </property>
</configuration>
[hadoop@hadoop004 conf]$ vim ~/.bash_profile

export HBASE_HOME=/home/hadoop/app/hbase-1.2.0-cdh5.12.0
export PATH=$HBASE_HOME/bin:$PATH

[hadoop@hadoop004 conf]$ source ~/.bash_profile
hadoop@hadoop004 hbase-1.2.0-cdh5.12.0]$ bin/start-hbase.sh
[hadoop@hadoop004 hbase-1.2.0-cdh5.12.0]$ bin/hbase shell

2019-06-05 17:53:21,984 INFO  [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop/app/hbase-1.2.0-cdh5.12.0/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop/app/hadoop-2.6.0-cdh5.7.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]
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.2.0-cdh5.12.0, rUnknown, Thu Jun 29 04:37:42 PDT 2017

hbase(main):001:0>
hbase(main):002:0* quit

伪分布式部署

对照着官网

[hadoop@hadoop004 hbase-1.2.0-cdh5.12.0]$ vim conf/hbase-site.xml
 <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>true</value>
  </property>
<property>
  <name>hbase.cluster.distributed</name>
  <value>true</value>
</property>
<property>
  <name>hbase.rootdir</name>
  <value>hdfs://hadoop004:9000/hbase</value>
</property>
<property>
  <name>hbase.zookeeper.quorum</name>
  <value>hadoop004:2181</value>
</property>
[hadoop@hadoop004 hbase-1.2.0-cdh5.12.0]$ vim conf/hbase-env.sh
#添加
export HBASE_MANAGES_ZK=false

启动

[hadoop@hadoop004 hbase-1.2.0-cdh5.12.0]$ bin/start-hbase.sh

Hbase单机&伪分布式部署

成功!!!

补充

伪分布式安装的时候并不是一帆风顺的,但是遇到问题一定不能慌,通过查找日志来排查问题

问题复现

Hbase单机&伪分布式部署
通过start-hbase.sh脚本启动Hbase,然后jps发现HMaster并没有启动

此时,查看HMaste的日志输出
Hbase单机&伪分布式部署

并没有有用的信息

[hadoop@hadoop004 hbase-1.2.0-cdh5.12.0]$ tail -200 /home/hadoop/app/hbase-1.2.0-cdh5.12.0/logs/hbase-hadoop-master-hadoop004.log

Hbase单机&伪分布式部署

问题就是出现在红框框这里,

解决方案,在hbase-site.xml文件
Hbase单机&伪分布式部署
搞定!!!

还有一开始,启动Hbase的时候会默认使用Hbase自带的ZooKeeper,但此时由于我的机子已经启动了ZooKeeper,并且占用了2181端口,所以也HMaster也启动失败了

解决方案
Hbase单机&伪分布式部署

Hbase单机&伪分布式部署
搞定!!!