phoenix安装配置

1、将apache-phoenix-5.0.0-HBase-2.0-bin.tar.gz上传至/opt/software

2、解压至/opt/module

[bigdata@bigdata01 software]$ tar -zxvf apache-phoenix-5.0.0-HBase-2.0-bin.tar.gz -C /opt/module/

3、修改名称

[bigdata@bigdata01 module]$ mv apache-phoenix-5.0.0-HBase-2.0-bin/ phoenix-5.0.0

4、配置环境变量

[bigdata@bigdata01 phoenix-5.0.0]$ sudo vim /etc/profile.d/my_env.sh

加入以下内容

#PHOENIX_HOME
export PHOENIX_HOME=/opt/module/phoenix-5.0.0
export PHOENIX_CLASSPATH=$PHOENIX_HOME
export PATH=$PATH:$PHOENIX_HOME/bin

使生效

[bigdata@bigdata01 phoenix-5.0.0]$ source /etc/profile.d/my_env.sh

5、复制server.jar文件到/opt/module/hbase-2.0.5/lib/

[bigdata@bigdata01 phoenix-5.0.0]$ cp phoenix-5.0.0-HBase-2.0-server.jar /opt/module/hbase-2.0.5/lib/

6、在当前/opt/module/hbase-2.0.5/lib/路径下将phoenix-5.0.0-HBase-2.0-server.jar分发到其他机器/opt/module/hbase-2.0.5/lib/路径下。

[bigdata@bigdata01 phoenix-5.0.0]$ cd /opt/module/hbase-2.0.5/lib/
[bigdata@bigdata01 lib]$ rsync.sh phoenix-5.0.0-HBase-2.0-server.jar 
==================== bigdata02 ====================
sending incremental file list
phoenix-5.0.0-HBase-2.0-server.jar

sent 41,810,648 bytes  received 35 bytes  27,873,788.67 bytes/sec
total size is 41,800,313  speedup is 1.00
==================== bigdata03 ====================
sending incremental file list
phoenix-5.0.0-HBase-2.0-server.jar

sent 41,810,648 bytes  received 35 bytes  27,873,788.67 bytes/sec
total size is 41,800,313  speedup is 1.00

7、修改配置文件

默认情况下,在phoenix中不能直接创建schema。需要将以下参数添加到Hbase中conf目录的hbase-site.xml和phoenix中bin目录的 hbase-site.xml中

<property>
      <name>phoenix.schema.isNamespaceMappingEnabled</name>
        <value>true</value>
</property>

8、重启hbase

[bigdata@bigdata01 ~]$ stop-hbase.sh 
stopping hbase............
[bigdata@bigdata01 ~]$ start-hbase.sh 
running master, logging to /opt/module/hbase-2.0.5/logs/hbase-bigdata-master-bigdata01.out
bigdata03: running regionserver, logging to /opt/module/hbase-2.0.5/logs/hbase-bigdata-regionserver-bigdata03.out
bigdata02: running regionserver, logging to /opt/module/hbase-2.0.5/logs/hbase-bigdata-regionserver-bigdata02.out
bigdata01: running regionserver, logging to /opt/module/hbase-2.0.5/logs/hbase-bigdata-regionserver-bigdata01.out

 9、二级索引

修改/opt/module/hbase-2.0.5/conf/hbase-site.xml

[bigdata@bigdata01 conf]$ pwd
/opt/module/hbase-2.0.5/conf
[bigdata@bigdata01 conf]$ vim hbase-site.xml 

增加以下内容

    <!-- phoenix regionserver 配置参数-->
    <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>

分发

[bigdata@bigdata01 conf]$ rsync.sh /opt/module/hbase-2.0.5/conf/hbase-site.xml 
==================bigdata02=====================
sending incremental file list
hbase-site.xml

sent 1,672 bytes  received 47 bytes  1,146.00 bytes/sec
total size is 2,250  speedup is 1.31
==================bigdata03=====================
sending incremental file list
hbase-site.xml

sent 1,672 bytes  received 47 bytes  3,438.00 bytes/sec
total size is 2,250  speedup is 1.31
[bigdata@bigdata01 conf]$ 

重启hbase。

 

10、两种启动方式:厚客户端和瘦客户端

10.1、厚客户端

[bigdata@bigdata01 bin]$ sqlline.py bigdata01,bigdata02,bigdata03:2181

10.2、瘦客户端

#先启动queryserver
[bigdata@bigdata01 bin]$ queryserver.py start
starting Query Server, logging to /tmp/phoenix/phoenix-bigdata-queryserver.log
#查看进程里是否有queryserver,如有说明启动
[bigdata@bigdata01 bin]$ jps
23716 HRegionServer
27637 SqlLine
27767 QueryServer
#启动瘦客户端
[bigdata@bigdata01 bin]$ sqlline-thin.py bigdata01:8765

 

posted @ 2021-09-30 10:53  iamzxd  阅读(557)  评论(0编辑  收藏  举报