标签:
1.安装phoenix
在界面上设置Phoenix的parcel包:
http://52.11.56.155:7180/cmf/settings?groupKey=config.scm.parcel.display_group&groupParent=
添加一个Remote Parcel Repository URLs url:http://archive.cloudera.com/cloudera-labs/phoenix/parcels/1.0/
CM会自动发现新的parcel,然后点击Download,Distribute and Active。重启集群
2.进入到某台服务器上,查看phoenix的安装路径
[root@ip-172-31-25-243 ~]# cd /opt/cloudera/parcels/CLABS_PHOENIX
[root@ip-172-31-25-243 phoenix]# lsbin dev examples lib phoenix-4.3.0-clabs-phoenix-1.0.0-client.jar phoenix-4.3.0-clabs-phoenix-1.0.0-server.jar phoenix-4.3.0-clabs-phoenix-1.0.0-server-without-antlr.jar
bin目录下为可执行文件,examples目录下为一些样例
3.导入CSV格式的表
CSV文件为/root/ceb/cis_cust_imp_info.csv,内容如下:
20131131,100010001001,BR01,2000.01
20131131,100010001002,BR01,2000.02
20131131,100010001003,BR02,2000.03
定义一个表结构的文件/root/ceb/cis_cust_imp_info.sql,内容如下,
CREATE TABLE IF NOT EXISTScis_cust_imp_info(
statistics_dtvarchar(50),
cust_idvarchar(50),
open_org_idvarchar(50),
assert9_baldecimal(18,2),CONSTRAINT pk PRIMARY KEY(statistics_dt, cust_id)
);
注意最后的分号是必须的。
运行命令,导入CSV
[root@ip-172-31-25-243 phoenix]# bin/psql.py 172.31.25.244 /root/ceb/cis_cust_imp_info.sql /root/ceb/cis_cust_imp_info.csv
SLF4J: Failed to load class"org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/cod