博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Hbase0.98.0完全分布式搭建---【使用外部zookeeper】
阅读量:6817 次
发布时间:2019-06-26

本文共 6333 字,大约阅读时间需要 21 分钟。

Hbase是一个分布式的实时数据库,他可以基于hadoop的hdfs,S3等分布式存储系统。而且使用zookeeper来通信(查询元数据和获取数据所在位置等功能)
本文的Hbase使用的是hadoop的hdfs和外部的zookeeper。在这里假设你已经搭建好hadoop和zookeeper。
 
Hbase搭建过程:
1.修改hbase-env.xml文件
export JAVA_HOME=/home/liangjf/app/jdk1.8.0_144     #java安装的根目录export HBASE_MANAGES_ZK=false    #false-使用非hbase自带的zookeeper。true-使用hbase自带的zookeeper
 
2.修改hbase-size.xml文件
hbase.rootdir
hdfs://master:9000/hbase
hbase.zookeeper.property.clientPort
2181
hbase.cluster.distributed
true
#指明使用完全分布式 false-单机或伪分布式
zookeeper.znode.parent
/hbase
#注意点1
hbase.master
hdfs://master:60000
hbase.zookeeper.quorum
master,slave1
dfs.datanode.max.xcievers
4096
注意点1:hbase是使用zookeeper来完成其功能的。所以肯定是在zookeeper上创建一个节点来存放其必须的信息。因此在启动hbase客户端的之前,必须在zookeeper上创建一个目录来保存数据。这里是/hbase(实际上这里的名字是随意的,不过为了方便使用了/hbase)。
步骤:
进入zookeeper/bin,执行命令 
[liangjf@master bin]$./zkCli.sh[zk: localhost:2181(CONNECTED) 0] ls /[zookeeper][zk: localhost:2181(CONNECTED) 0] create /hbase "123"[zk: localhost:2181(CONNECTED) 0] ls /[zookeeper, hbase]
如果缺少在zookeeper上创建 /hbase这一步( create /hbase "123" ),在使用的时候会出现以下错误。在这里吐槽一下,网上出现这个错误的解决办法真少。
hbase(main):001:0> listTABLE                                                                                                                                                     SLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/home/liangjf/app/hbase-0.98.0-hadoop1/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: Found binding in [jar:file:/home/liangjf/app/hadoop-1.2.1/lib/slf4j-log4j12-1.4.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.2017-11-18 10:07:38,240 ERROR [main] client.HConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.2017-11-18 10:07:38,344 ERROR [main] client.HConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.2017-11-18 10:07:38,553 ERROR [main] client.HConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.2017-11-18 10:07:38,863 ERROR [main] client.HConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.2017-11-18 10:07:39,369 ERROR [main] client.HConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master
 
3.分发整个hbase目录到各节点
scp -r /home/liangjf/app/hbase-0.98.0-hadoop1 liangjf@slave1:/home/liangjf/app

 

4.启动hbase
进入 /hbase-0.98.0-hadoop1/bin/ 下, ./start-hbase.sh
 
5.启动hbase客户端
进入 /hbase-0.98.0-hadoop1/bin/ 下, 执行命令 hbase shell ,进入shell客户端。
 
6.测试
hbase(main):006:0> create 'member','address','info'0 row(s) in 0.7770 seconds=> Hbase::Table - member hbase(main):009:0> listTABLE                                                                                                                                                     member                                                                                                                                                    1 row(s) in 0.0410 seconds=> ["member"] hbase(main):015:0> describe 'member'DESCRIPTION                                                                                         ENABLED                                               'member', {NAME => 'address', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DE true                                                  LETED_CELLS => 'false', DATA_BLOCK_ENCODING => 'NONE', TTL => '2147483647', COMPRESSION => 'NONE',                                                         MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}, {NAME                                                         => 'info', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'fa                                                       lse', DATA_BLOCK_ENCODING => 'NONE', TTL => '2147483647', COMPRESSION => 'NONE', MIN_VERSIONS => '                                                       0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}                                                                                1 row(s) in 0.0560 seconds hbase(main):022:0> put'member','zhangsan','info:age','24'0 row(s) in 0.1560 secondshbase(main):023:0> put'member','lisi','info:birthday','1994-01-01'0 row(s) in 0.0120 seconds hbase(main):038:0> scan 'member'ROW                                     COLUMN+CELL                                                                                                                                                 zhangsan                                column=info:age, timestamp=1511029691288, value=24                                                               lisi                                    column=info:birthday, timestamp=1511029538058, value=1994-01-01

 

 

转载于:https://www.cnblogs.com/liangjf/p/7857707.html

你可能感兴趣的文章
Understanding Recursion
查看>>
学习笔记——JavaScript 编码规范
查看>>
redux middleware 源码分析
查看>>
小程序中怎么显示html 内容
查看>>
vue-cli (vue2.5.2&webpack3.6.0) 配置文件全注释
查看>>
vue-cli发布版本时,打包问题的正确解决方案
查看>>
从线程池到synchronized关键字详解
查看>>
Android 彻底掌握Binder
查看>>
apicloud弹出层
查看>>
从入门到菜鸟的经验分享
查看>>
python疑问6:生成器,可迭代对象,迭代器区别和联系
查看>>
【299天】跃迁之路——程序员高效学习方法论探索系列(实验阶段57-2017.12.01)...
查看>>
对象的点查询和中括号查询
查看>>
一行代码搞定人脸识别
查看>>
python3进程和线程
查看>>
【quickhybrid】Android端的项目实现
查看>>
Webpack3简单入门1
查看>>
好的代码可以自己说话!
查看>>
css揭秘笔记——用户体验
查看>>
【287天】每日项目总结系列025(2017.11.19)
查看>>