Phoenix可以有4种方式调用:
CREATE TABLE IF NOT EXISTS user_phoenix ( state CHAR(2) NOT NULL, city VARCHAR NOT NULL, population BIGINT CONSTRAINT my_pk PRIMARY KEY (state, city));
NY,New York,8143197
CA,Los Angeles,3844829
IL,Chicago,2842518
TX,Houston,2016582
PA,Philadelphia,1463281
AZ,Phoenix,1461575
TX,San Antonio,1256509
CA,San Diego,1255540
TX,Dallas,1213825
CA,San Jose,912332
SELECT state as "State",count(city) as "City Count",sum(population) as "Population Sum" FROM user_phoenix GROUP BY state ORDER BY sum(population) DESC;
/var/local/phoenix/bin/psql.py node-1:2181 user_phoenix.sql user_phoenix.csv user_phoenix_query.sql
命令含义:创建表、插入数据、查询结果
用Hbase shell 查看会有一个 USER_PHOENIX 表,用scan 命令查看一下这个表的数据。
hbase(main):04:0> scan 'USER_PHOENIX'
ROW COLUMN+CELL
AZPhoenix column=0:POPULATION, timestamp=1484736243467, value=\x80\x00\x00\x00\x00\x16
MG
AZPhoenix column=0:_0, timestamp=1484736243467, value=x
CALos Angeles column=0:POPULATION, timestamp=1484736243467, value=\x80\x00\x00\x00\x00:\xA
A\xDD
CALos Angeles column=0:_0, timestamp=1484736243467, value=x
CASan Diego column=0:POPULATION, timestamp=1484736243467, value=\x80\x00\x00\x00\x00\x13
(t
CASan Diego column=0:_0, timestamp=1484736243467, value=x
CASan Jose column=0:POPULATION, timestamp=1484736243467, value=\x80\x00\x00\x00\x00\x0D
\xEB\xCC
CASan Jose column=0:_0, timestamp=1484736243467, value=x
ILChicago column=0:POPULATION, timestamp=1484736243467, value=\x80\x00\x00\x00\x00+_\x
96
ILChicago column=0:_0, timestamp=1484736243467, value=x
PAPhiladelphia column=0:POPULATION, timestamp=1484736243467, value=\x80\x00\x00\x00\x00\x16
S\xF1
PAPhiladelphia column=0:_0, timestamp=1484736243467, value=x
TXDallas column=0:POPULATION, timestamp=1484736243467, value=\x80\x00\x00\x00\x00\x12
\x85\x81
TXDallas column=0:_0, timestamp=1484736243467, value=x
TXHouston column=0:POPULATION, timestamp=1484736243467, value=\x80\x00\x00\x00\x00\x1E
\xC5F
TXHouston column=0:_0, timestamp=1484736243467, value=x
TXSan Antonio column=0:POPULATION, timestamp=1484736243467, value=\x80\x00\x00\x00\x00\x13
,=
TXSan Antonio column=0:_0, timestamp=1484736243467, value=x
总结:
喜欢就点赞评论+关注吧
感谢阅读,希望能帮助到大家,谢谢大家的支持!