Phoenix overview and its installation and deployment

Overview

concept

Phoenix is ​​a tool that provides SQL queries and converts SQL to JavaAPI to operate Hbase

Features

  • Specially based on the SQL on Hbase tools involved in Hbase
  • Use Phoenix to implement SQL-based operation of Hbase
  • Use Phoenix to automatically build secondary indexes and maintain secondary indexes

principle

  • The upper layer provides SQL interface

The bottom layer is all realized by Hbase Java API, and data reading and writing are realized by constructing a series of Scan and Put

  • Very rich in features

The bottom layer encapsulates a large number of built-in coprocessors, which can achieve various complex processing requirements, such as secondary indexes, etc.

Features

  • advantage
  1. Support SQL interface
  2. Support automatic maintenance of secondary indexes
  • Disadvantage
  1. The syntax supported by SQL is not comprehensive
  2. More bugs
  • Hive on Hbase comparison
  1. Hive: SQL is more comprehensive, but does not support secondary indexes. The bottom layer is implemented by distributed computing tools
  2. Phoenix: SQL is relatively incomplete, but the performance is better. Use HbaseAPI directly to support index implementation

application

  • Phoenix is ​​suitable for any scenario that needs to use SQL or JDBC to quickly read and write Hbase
  • Or need to build and maintain a secondary index scenario

Installation and deployment

  1. Download
    link: https://pan.baidu.com/s/11q28N8qwbPIMLclXwRLu2Q Password: 9jk3

  2. Upload and decompress on the first machine
    cd /export/software/

  3. The first machine to unzip

tar -zxvf apache-phoenix-5.0.0-HBase-2.0-bin.tar.gz -C /export/server/
cd /export/server/
mv apache-phoenix-5.0.0-HBase-2.0-bin phoenix-5.0.0-HBase-2.0-bin
  1. Modify the number of file handles on three Linux
vim /etc/security/limits.conf
#在文件的末尾添加以下内容,*号不能去掉

* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
  1. Distribute all the jar packages of Phoenix to the lib directory of Hbase
#拷贝到第一台机器
cd /export/server/phoenix-5.0.0-HBase-2.0-bin/
cp phoenix-* /export/server/hbase-2.1.0/lib/
cd /export/server/hbase-2.1.0/lib/
#分发给第二台和第三台
scp phoenix-* node2:$PWD
scp phoenix-* node3:$PWD
  1. Modify hbase-site.xml and add attributes
cd /export/server/hbase-2.1.0/conf/
vim hbase-site.xml

添加如下内容:
<!-- 关闭流检查,从2.x开始使用async -->
<property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
  </property>
<!-- 支持HBase命名空间映射 -->
<property>
    <name>phoenix.schema.isNamespaceMappingEnabled</name>
    <value>true</value>
</property>
<!-- 支持索引预写日志编码 -->
<property>
  <name>hbase.regionserver.wal.codec</name>
  <value>org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec</value>
</property>
<!-- 配置NS映射 -->
<property>
  <name>phoenix.schema.isNamespaceMappingEnabled</name>
  <value>true</value>
</property>
  1. Synchronize to the other two machines
scp hbase-site.xml node2:$PWD
scp hbase-site.xml node3:$PWD
  1. Synchronize to Phoenix
cp hbase-site.xml /export/server/phoenix-5.0.0-HBase-2.0-bin/bin/
  1. Restart Hbase
stop-hbase.sh
start-hbase.sh
  1. Start Phoenix
cd /export/server/phoenix-5.0.0-HBase-2.0-bin/
bin/sqlline.py node1:2181
  1. test
    !tables
    Insert picture description here

Guess you like

Origin blog.csdn.net/zh2475855601/article/details/115142908