1、相关文件路径

hbase:

/opt/cloudera/parcels/CDH-6.2.0-1.cdh6.2.0.p0.967373/lib/hbase/lib

下载:apache-phoenix-5.0.0-HBase-2.0-bin.tar.gz  连接:http://archive.apache.org/dist/phoenix/

cp apache-phoenix-5.0.0-HBase-2.0-bin.tar.gz /app/

tar –zxf apache-phoenix-5.0.0-HBase-2.0-bin.tar.gz

mv apache-phoenix-5.0.0-HBase-2.0   phoenix

​​​​​​​2、配置环境变量:

Vim /etc/profile

export PHOENIX_HOME=/app/phoenix

export PHOENIX_CLASSPATH=$PHOENIX_HOME

export PATH=$PATH:$PHOENIX_HOME/bin

​​​​​​​3、复制jar包到hbase/lib/

cd /app/phoenix/

cp phoenix-5.0.0-HBase-2.0-server.jar  phoenix-core-5.0.0-HBase-2.0.jar phoenix-5.0.0-HBase-2.0-client.jar /opt/cloudera/parcels/CDH-6.2.0-1.cdh6.2.0.p0.967373/lib/hbase/lib/

​​​​​​​4、重启hbase服务

手动部署phoenix到CDH6.2.0的hbase2.1.0中

​​​​​​​5、验证phoenix shell 操作

# phoenix.py  localhost:2181

a.显示所有的表

  !table或者!tables

b.创建表

直接指定单个列作为Rowkey

在Phoenix中,表名和字段等这些会自动转换为大写,若要小写,则使用双引号,如“us_population”,指定多个列联合作为rowkey:

CREATE TABLE IF NOT EXISTS US_POPULATION(

state char(2) not null,

city varchar not null,

population bigint

Constraint my_pk primary key(state,city)

);

c.插入\修改数据

upsert into US_POPULATION values(‘11’,’beijing’,30);

d.查询记录

select * from US_POPULATION where state=’11’;

e.删除记录

Delete from US_POPULATION where state=’11’;

f.删除表

Drop table  US_POPULATION;

g.退出:!quit  or  !exit

感谢各位!!!

相关文章:

  • 2021-07-17
  • 2022-12-23
  • 2021-12-08
  • 2021-12-18
  • 2021-08-13
  • 2021-05-18
  • 2022-01-23
  • 2022-12-23
猜你喜欢
  • 2021-12-20
  • 2021-11-21
  • 2021-06-29
  • 2021-08-23
  • 2021-10-09
  • 2021-12-21
  • 2021-06-13
相关资源
相似解决方案