1 Phoenix概览
Phoenixis a SQL layer over HBase, delivered as a client-embedded JDBC driver, poweringthe HBase use cases at Salesforce.com. Phoenix targets low-latency queries(milliseconds), as opposed to batch operation via map/reduce. To see what'ssupported, go to our languagereference guide, and read more on ourwiki.
2 Phoenix安装
To install a pre-built phoenix, use these directions:
- Download and expand the latest phoenix-[version]-install.tar from download page
- Add the phoenix-[version].jar to the classpath of every HBase region server. An easy way to do this is to copy it into the HBase lib directory.
- Restart all region servers.
- Add the phoenix-[version]-client.jar to the classpath of any Phoenix client.
Alternatively, you can build it yourself using maven byfollowing these buildinstructions.
3 Phoenix测试
测试集群
192.168.1.11
192.168.1.12
测试版本
HbaseVersion 0.94.2.21
Phoenixv 1.0
sql语句
CREATETABLE IF NOT EXISTS STOCK_SYMBOL (SYMBOL VARCHAR NOT NULL PRIMARY KEY, COMPANYVARCHAR);
UPSERT INTOSTOCK_SYMBOL VALUES ('CRM','SalesForce.com');
SELECT * FROMSTOCK_SYMBOL;
执行
#java -jar phoenix-1.0-client.jar hadoopnode2.qyops.com test.sql结果
SYMBOL COMPANY
--------------------
CRM SalesForce.com
表结构
hbase(main):036:0> describe 'STOCK_SYMBOL'
DESCRIPTION ENABLED
{NAME => 'STOCK_SYMBOL',coprocessor$4 => 'phoenix.jar|com.sales true
force.phoenix.join.HashJoiningRegionObserver|1|',coprocessor$3
=>'phoenix.jar|com.salesforce.phoenix.coprocessor.GroupedAggreg
ateRegionObserver|1|',coprocessor$2 => 'phoenix.jar|com.salesfo
rce.phoenix.coprocessor.UngroupedAggregateRegionObserver|1|',co
processor$1 =>'phoenix.jar|com.salesforce.phoenix.coprocessor.S
canRegionObserver|1|',FAMILIES => [{NAME => '_0', DATA_BLOCK_EN
CODING => 'FAST_DIFF',BLOOMFILTER => 'NONE', REPLICATION_SCOPE
=> '0', VERSIONS =>'3', COMPRESSION => 'NONE', MIN_VERSIONS =>
'0', TTL => '2147483647',KEEP_DELETED_CELLS => 'true', BLOCKSIZ
E => '65536', IN_MEMORY=> 'false', ENCODE_ON_DISK => 'true', BL
OCKCACHE => 'true'}]}
1 row(s) in 0.0400 seconds