CDH版 Phoenix 安装以及简单使用

  • 下载
    进入 /opt/cloudera/parcel-repo 目录
wget http://www.apache.org/dist/phoenix/apache-phoenix-4.14.0-cdh5.12.2/parcels/APACHE_PHOENIX-4.14.0-cdh5.12.2.p0.3-el7.parcel
wget http://www.apache.org/dist/phoenix/apache-phoenix-4.14.0-cdh5.12.2/parcels/manifest.json
  • 计算hash
sha1sum APACHE_PHOENIX-4.14.0-cdh5.12.2.p0.3-el7.parcel
  • 把hash值写入
vi SPARK2-2.2.0.cloudera2-1.cdh5.12.0.p0.232957-el7.parcel.sha
  • 然后cdh 分配Phoenix
  • 每个RegionServer都要复制
cp /opt/cloudera/parcels/APACHE_PHOENIX/lib/phoenix/phoenix-4.14.0-cdh5.12.2-server.jar /opt/cloudera/parcels/CDH-5.13.1-1.cdh5.13.1.p0.2/lib/hbase/lib/

启动

./sqlline.py 
  • 创建表
CREATE TABLE IF NOT EXISTS dept (
      deptno Integer,
    dname varchar(14),
    loc varchar(13)
      CONSTRAINT dept_pk PRIMARY KEY (deptno));
  • 插入数据
upsert into dept values (10, 'ACCOUNTING', 'NEW YORK');
upsert into dept values (20, 'RESEARCH', 'DALLAS');
upsert into dept values (30, 'SALES', 'CHICAGO');
upsert into dept values (40, 'OPERATIONS', 'BOSTON');
  • 查询数据
0: jdbc:phoenix:> select * from dept;
+---------+-------------+-----------+
| DEPTNO  |    DNAME    |    LOC    |
+---------+-------------+-----------+
| 10      | ACCOUNTING  | NEW YORK  |
| 20      | RESEARCH    | DALLAS    |
| 30      | SALES       | CHICAGO   |
| 40      | OPERATIONS  | BOSTON    |
+---------+-------------+-----------+

你可能感兴趣的:(hbase,phoenix)