cdh5.8.0集成phoenix
作者:互联网
cdh5.8.0集成phoenix
1、下载编译cdh版本适配phoenix
#下载源码
git clone https://github.com/chiastic-security/phoenix-for-cloudera.git
cd phoenix-for-cloudera/
git branch --all
git checkout remotes/origin/4.8-HBase-1.2-cdh5.8
#编译
mvn clean package -DskipTests -Dcdh.flume.version=1.6.0
2、获取编译后的压缩包
- 打包后安装包路径:. ./phoenix-assembly\target\phoenix-4.8.0-cdh5.8.0.tar.gz
注意
需要maven3.0+的环境进行编译
3、拷贝安装
- 将phoenix-4.8.0-cdh5.8.0.tar.gz远程copy至对应服务器
- 解压phoenix-4.8.0-cdh5.8.0.tar.gz至/opt目录
- 进入解压目录,找到phoenix-4.8.0-cdh5.8.0-server.jar,将其拷贝到每个RegionServer目录(/opt/cloudera/parcels/CDH/lib/hbase/lib)下
4、hbase配置文件
- 可采用CDH界面进行配置
<property>
<name>hbase.table.sanity.checks</name>
<value>false</value>
</property>
<property>
<name>hbase.regionserver.wal.codec</name>
<value>org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec</value>
</property>
<property>
<name>hbase.region.server.rpc.scheduler.factory.class</name>
<value>org.apache.hadoop.hbase.ipc.PhoenixRpcSchedulerFactory</value>
<description>Factory to create the Phoenix RPC Scheduler that uses separate queues for index and metadata updates</description>
</property>
<property>
<name>hbase.rpc.controllerfactory.class</name>
<value>org.apache.hadoop.hbase.ipc.controller.ServerRpcControllerFactory</value>
<description>Factory to create the Phoenix RPC Scheduler that uses separate queues for index and metadata updates</description>
</property>
- cdh界面配置如图
- 通过cdh重启hbase服务
4、连接测试
进入phoenix-4.8.0-cdh5.8.0/bin目录,使用sqlline.py连接hbase,成功即可
./sqlline.py zk:2181/hbase
5、操作命令
- 查看表
!tables
- 创建表
CREATE TABLE USER (ID BIGINT NOT NULL PRIMARY KEY, NAME VARCHAR NULL,AGE INTEGER NULL, ADDRESS VARCHAR NULL) ;
- 创建本地索引
CREATE LOCAL INDEX USER_IDX ON USER(NAME);
- 插入数据
UPSERT INTO USER(ID,NAME,AGE,ADDRESS) VALUES(1,'name1',11,'china');
- 查询数据
SELECT * FROM USER;
标签:集成,phoenix,cdh5.8,4.8,编译,USER,hbase 来源: https://blog.csdn.net/weixin_43379828/article/details/118539746