免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2294 | 回复: 1

[HBase] hbase web console simplehbaseviewer v0.7简介及使用说明 [复制链接]

论坛徽章:
0
发表于 2014-03-27 00:10 |显示全部楼层
https://github.com/zhang-xzhi/simplehbaseviewer
https://github.com/zhang-xzhi/simplehbaseviewer/wiki/_pages

##v0.7功能变更

新增viewer的样例page中,可以一键跑所有的样例hql功能,避免代码失配,导致样例hql不能执行。
适配SimpleHbaseCellResult的改动。
调整配置文件中bean的名字。
调整包结构。
新增DisplayOnlyStringRowKey。

##simplehbaseviewer简介

simplehbaseviewer是基于simplehbase的web操作界面.

目前提供以下功能:

htable插入数据,指定时间戳。

htable查询数据,SQL-Like,可以指定maxversion,时间戳范围,limit分页查询。

htable删除数据。

自定义rowkey生成函数,方便查询。 例子: 有一个rowkey的设计如下: 月账单rowkey设计如下: md5(userId)前4位userId反转账单周期反转 自定义一个rowkey生成函数billCategoryRowKey,配置在simplehbaseviewer中,可以使用如下方式查询。

select * from billCategory rowkey is billCategoryRowKey ("2088123456781234_20140401")


     query console:
     可以对htable进行数据put,scan, delete操作。
     
     example:
     比如
      
     insert into billCategory  ( userId ) values ( "2088123456781234" ) rowkey is billCategoryRowKey ("2088123456781234_20140401")
     
     insert into MyRecordV05 ( name,age ) values ( "allen", "30" ) rowkey is intkey ("0")   
     
     insert into MyRecordV05 ( fatname,age ) values ( "allenfat", "30" ) rowkey is intkey ("0")
     
     insert into MyRecordV05 ( name ) values ( null ) rowkey is intkey ("0")
     
     
     
     select * from  billCategory   startkey is billCategoryRowKey ("2088123456781234_20140401")
     
     select * from MyRecordV05 startkey is intkey ("0") , endkey is intkey ("100") maxversion 10 startTS is "2014-01-01" , endTS is "2100-01-01" limit 10 , 20
     
     select * from MyRecordV05 startkey is intkey ("0")  startTS is "2014-01-01" limit 10 , 20
     
     select * from MyRecordV05 startkey is intkey ("0")
     
     select * from MyRecordV05 rowkey is intkey ("0")   
     
     
     delete * from MyRecordV05 startkey is intkey ("0")  

![hbaseviewer](http://img2.tbcdn.cn/L1/461/1/b_13584_1394620203_1973523339.jpeg)



##simphbase simplehbaseviewer使用说明
### simplehbase/simplehbaseviewer版本
0.5.1 / 0.6 / 0.7

### jdk
jdk/jre 1.6

### maven
maven2

### 代码下载
最新simplehbase代码下载。
https://github.com/zhang-xzhi/simplehbase
右下角的download zip。

带版本的simplehbase版本下载。
https://github.com/zhang-xzhi/simplehbase/releases

最新simplehbaseviewer代码下载。
https://github.com/zhang-xzhi/simplehbaseviewer
右下角的download zip。

带版本的simplehbaseviewer版本下载。
https://github.com/zhang-xzhi/simplehbaseviewer/releases

### Simplehbase本地验证
代码下载后,mvn eclipse:eclipse后导入eclipse。
运行simplehbase的test。(Junit)

目前simplehbase默认的测试环境为

    hbase.zookeeper.quorum=hbdev-1.alipay.net,hbdev-2.alipay.net,hbdev-3.alipay.net,hbdev-4.alipay.net,hbdev-5.alipay.net
    hbase.zookeeper.property.clientPort=2181
    zookeeper.znode.parent=/hbase-94

* 1 若无法连接,修改test/zk_conf文件(集成测试使用,修改sample/zk_conf文件(样例程序使用)。
* 2 建测试表。运行CreateTestTable, 新建MyRecordV05表。
* 3 建表成功后,重新运行test,后续运行,不需要重新建立测试表。
* 4 新增htable的配置,请参考既有表的配置。

### Simplehbaseviewer本地验证
安装simplehbase到本地仓库。
在simplehbase项目中,mvn install。

simplehbaseviewer代码下载后,mvn eclipse:eclipse后导入eclipse。

运行Main。

访问http://localhost:4040/hbaseviewer/
看simplehbaseview是否启动正常。

目前simplehbaseviewer默认的测试环境为

    hbase.zookeeper.quorum=hbdev-1.alipay.net,hbdev-2.alipay.net,hbdev-3.alipay.net,hbdev-4.alipay.net,hbdev-5.alipay.net
    hbase.zookeeper.property.clientPort=2181
    zookeeper.znode.parent=/hbase-94

* 1 若无法连接,修改config/zk_conf文件。
* 2 建测试表。运行CreateTestTable, 新建MyRecordV05表。
* 3 建表成功后,重新运行Main。

### Simplehbase jar包依赖
pom依赖,请参考simplehbase的pom文件。

其中,hadoop和hbase可以修改为目前集团hbase使用的版本。

Simplehbase开发测试过程中使用的hbase版本为0.94.0。

理论上,hbase0.92也可以使用,但是未经测试,可以跑test进行测试。

### Simplehbaseclient配置
SimpleHbaseClient为simplehbase的核心接口。

Java方式配置可以参考simplehbase的SampleMain。

Spring方式配置可以参考simplehbaseviewer的
\hbaseviewer\WEB-INF\spring\simplehbase.xml

如何配置可以参考或直接查看代码:
https://github.com/zhang-xzhi/si ... -%E9%85%8D%E7%BD%AE

### doc
* https://github.com/zhang-xzhi/simplehbase/wiki
* https://github.com/zhang-xzhi/simplehbaseviewer/wiki
* simplehbase下载后simplehbase\doc

论坛徽章:
49
15-16赛季CBA联赛之福建
日期:2016-06-22 16:22:002015年亚洲杯之中国
日期:2015-01-23 16:25:12丑牛
日期:2015-01-20 09:39:23未羊
日期:2015-01-14 23:55:57巳蛇
日期:2015-01-06 18:21:36双鱼座
日期:2015-01-02 22:04:33午马
日期:2014-11-25 09:58:35辰龙
日期:2014-11-18 10:40:07寅虎
日期:2014-11-13 22:47:15申猴
日期:2014-10-22 15:29:50摩羯座
日期:2014-08-27 10:49:43辰龙
日期:2014-08-21 10:47:58
发表于 2014-03-28 08:53 |显示全部楼层
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP