hbase伪分布式的配置

HBase的安装有两种种模式:单机模式和分布式模式,其中分布式模式又分为伪分布模式和完全分布式模式。
单机模式适合初学者了解hbase的命令行使用,无需hadoop就可以运行:参考 http://blog.csdn.net/god_wot/article/details/6829427
分布式模式依赖hdfs,因此需提前安装好hadoop。
伪分布模式,和hadoop的伪分布式模式一样,指在一台主机上运行所有进程的模式,这种方式用来熟悉hbase或做开发、测试用。
完全分布式模式,在生产环境中使用这种模式。
下面为如何在单机上配置hbase伪分布式模式:
1.提前准备好hadoop,并运行起来,我机器上配置了hadoop的伪分布式环境
2.打开hbase.site.xml
<configuration>
     <property>
          <name>hbase.rootdir</name>
          <value>hdfs://localhost:9000/hbase</value> <!--hbase在hdfs上的目录-->
      </property>
      <property>
           <name>dfs.replication</name>
           <value>1</value>
       </property>
</configuration>
3.在hbase-env.sh配置JAVA_HOME
也可以根据自己的需要配置下面的的选项
#   HBASE_LOG_DIR    Where log files are stored.  PWD by default.
#   HBASE_PID_DIR    The pid files are stored. /tmp by default.
#   HBASE_CLASSPATH

4.把HBASE_HOME以及bin目录配置到系统环境变量中(可选)

5.然后就可以启动了hbase了
hadoop@ubuntu:~/hbase-1.2.2/conf$ ../bin/start-hbase.sh
starting master, logging to /home/hadoop/hbase-1.2.2/bin/../logs/hbase-hadoop-master-ubuntu.out
hadoop@ubuntu:~/hbase-1.2.2/conf$ ../bin/hbase shell
2017-01-16 22:39:42,301 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop/hbase-1.2.2/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop/hadoop/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.2, r3f671c1ead70d249ea4598f1bbcc5151322b3a13, Fri Jul 1 08:28:55 CDT 2016

hbase(main):001:0> list
TABLE
0 row(s) in 0.4610 seconds

=> []
hbase(main):003:0>

在hdfs中也有了hbase文件夹:
hadoop@ubuntu:~/hbase-1.2.2/bin$ hdfs dfs -ls  /
17/01/16 23:08:35 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 5 items
drwxr-xr-x   - hadoop supergroup          0 2016-08-01 19:17 /data
drwxr-xr-x   - hadoop supergroup          0 2017-01-16 22:39 /hbase
drwxr-xr-x   - hadoop supergroup          0 2017-01-16 19:48 /tmp
drwxr-xr-x   - hadoop supergroup          0 2016-07-06 00:12 /user
hadoop@ubuntu:~/hbase-1.2.2/bin$
或通过浏览器查看:http://192.168.134.136:50070/explorer.html#/hbase/


6.备注:
若出现:ERROR [main] zookeeper.RecoverableZooKeeper: ZooKeeper exists failed after 4 attempts
或ERROR: Can't get master address from ZooKeeper; znode data == null
检查下 是不是不小心配置成了完全分布式 
hbase-env.sh 里把# export HBASE_MANAGES_ZK=true 注释掉
hbase-site.xml 里把hbase.cluster.distributed、base.master、hbase.zookeeper.property.dataDir、hbase.zookeeper.quorum等去掉即可
或者其他配置错误,比如:把<name>dfs.replication</name>别写成了hbase.replication等
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值