网址 https://github.com/forcedotcom/phoenix/wiki[[BR]]
效率号称比hive要好,不用使用job来做
要装在hbase 0.94.2以上的版本,使用squirrel sql client的时候要注意把phoenix的client驱动复制到squirrel lib目录下
可以使用create table的方式创建表也可以映射现有的表
建表的时候带有column family的信息
表的metadata会保存在SYSTEM.TABLE 表中
CREATE TABLE IF NOT EXISTS WEB_STAT (
HOST CHAR(2) NOT NULL,
DOMAIN VARCHAR NOT NULL,
FEATURE VARCHAR NOT NULL,
DATE DATE NOT NULL,
USAGE.CORE BIGINT,
USAGE.DB BIGINT,
STATS.ACTIVE_VISITOR INTEGER
CONSTRAINT PK PRIMARY KEY (HOST, DOMAIN, FEATURE, DATE)
)
如果创建的表名在HBASE上面已经存在,可以映射现有的表,有几个地方要注意
表名,字段名最好都使用大写
建表的时候会在每条row的第一个columnfamily字段增加一个空的column ,命名为_0,说是为了提高性能
At create time, an empty key value is added to the first column family of any existing rows. Upserts will also add this empty key value. This is done to improve query performance by having a key value column we can guarantee always being there (minimizing the amount of data that must be projected). Alternately, if a view is created, the HBase table and column families must already exist. No empty key value is added to existing rows and no data mutations are allowed - the view is read-only. Query performance for a view will not be as good as performance for a table. For a table only, HBase table and column configuration options may be passed through as key/value pairs to setup the HBase table as needed.
因为对现有的表有入侵,现在测试环境试一下,以免搞坏生产环境的表
建view的时候,所有的cf都要在view里面出现,不然会建立不成功,不知道什么回事
建表文档 http://forcedotcom.github.com/phoenix/#create
感觉这个工具只适合做一些固定column数的应用的表的查询
![(please configure the [header_logo] section in trac.ini)](http://www1.pconline.com.cn/hr/2009/global/images/logo.gif)