Phoenix
Hbase查询工具,提供在hbase中sql方式查询。提供了很多sql语法,二级索引等传统数据库支持的功能。新版本中有支持transaction(beta)。
官网
http://phoenix.apache.org/Phoenix-in-15-minutes-or-less.html、
二进制文件下载
http://mirror.bit.edu.cn/apache/phoenix/apache-phoenix-4.9.0-HBase-1.2/bin/
部署安装
To install a pre-built phoenix, use thesedirections:
· Download and expand the latest phoenix-[version]-bin.tar.
· Add the phoenix-[version]-server.jar to the classpath ofall HBase region server and master and remove any previous version. An easy wayto do this is to copy it into the HBase lib directory (usephoenix-core-[version].jar for Phoenix 3.x)
· Restart HBase.
· Add the phoenix-[version]-client.jar to the classpath ofany Phoenix client.
· 4、配置Phoenix
· 4.1、将phoenix-4.9.0-HBase-1.2-bin/目录下phoenix-core-4.9.0-HBase-1.2.jar、phoenix-4.9.0-HBase-1.2-server.jar拷贝到各个hbase的lib目录下。
· 4.2、将hbase的配置文件hbase-site.xml、Hadoop/etc/hadoop下的core-site.xml、hdfs-site.xml放到phoenix-4.9.0-HBase-1.2-bin/bin/下,替换Phoenix原来的配置文件。
· 4.3、重启hbase集群,使Phoenix的jar包生效。
Hbase表映射到Phoenix
1、安装好phoenix后对于Hbase中已经存在的数据表不会自动进行映射,所以想要再phoenix中操作HBase已有数据表就需要手动进行配置。
官网,how i map a existing hbase table
http://blog.youkuaiyun.com/maomaosi2009/article/details/45598985
2、在Phoenix中建立相对于hbase表的视图 view
http://stackoverflow.com/questions/29840477/phoenix-map-existing-hbase-table
Java开发
http://www.itdadao.com/articles/c15a1289911p0.html
hbase清除数据
Usage: hbase clean (--cleanZk|--cleanHdfs|--cleanAll)
Options:
--cleanZk cleans hbase related data from zookeeper.
--cleanHdfs cleans hbase related data from hdfs.
--cleanAll cleans hbase related data from both zookeeper and hdfs.