`

Phoenix常见用法

阅读更多

 

1. Load Data into Phoenix

  • Using our map-reduce based CSV loader for bigger data sets     http://phoenix.apache.org/bulk_dataload.html
hadoop jar phoenix-<version>-client.jar org.apache.phoenix.mapreduce.CsvBulkLoadTool --table EXAMPLE --input /data/example.csv

 

  • Using psql.py to load .csv file        http://phoenix.apache.org/bulk_dataload.html
bin/psql.py -t EXAMPLE localhost data.csv

 

  • Mapping an existing HBase table to a Phoenix table and using the UPSERT SELECT command to populate a new table.
create 't1', {NAME => 'cf1', VERSIONS => 5}   --define table and column family 'cf1' in hbase shell
CREATE VIEW t1 ( pk VARCHAR PRIMARY KEY, cf1.column1 VARCHAR, cf1.column2 INTEGER);    --create view in phoenix sqlline.py for t1

--Instead, you can create the table in phoenix directly
CREATE TABLE t1 ( pk VARCHAR PRIMARY KEY, column1 VARCHAR,  column2 INTEGER);

 

  • Populating the table through our UPSERT VALUES command.
upsert into test_table values (2,'World!');

 

 

2. Using client tool SQuirrel

  1. Remove prior phoenix-[oldversion]-client.jar from the lib directory of SQuirrel, copy phoenix-[newversion]-client.jar to the lib directory (newversion should be compatible with the version of the phoenix server jar used with your HBase installation)
  2. Start SQuirrel and add new driver to SQuirrel (Drivers -> New Driver)
  3. In Add Driver dialog box, set Name to Phoenix, and set the Example URL to jdbc:phoenix:localhost.
  4. Type “org.apache.phoenix.jdbc.PhoenixDriver” into the Class Name textbox and click OK to close this dialog.
  5. Switch to Alias tab and create the new Alias (Aliases -> New Aliases)
  6. In the dialog box, Name: any name, Driver: Phoenix, User Name: anything, Password: anything
  7. Construct URL as follows: jdbc:phoenix: zookeeper quorum server. For example, to connect to a local HBase use: jdbc:phoenix:localhost
  8. Press Test (which should succeed if everything is setup correctly) and press OK to close.
  9. Now double click on your newly created Phoenix alias and click Connect. Now you are ready to run SQL queries against Phoenix.

 

3. Performance optimizing

pre-splitting the data into multiple regions

CREATE TABLE TEST (HOST VARCHAR NOT NULL PRIMARY KEY, DESCRIPTION VARCHAR) SALT_BUCKETS=16

 

Per-split table by row key

CREATE TABLE TEST (HOST VARCHAR NOT NULL PRIMARY KEY, DESCRIPTION VARCHAR) SPLIT ON ('CS','EU','NA')

 

Use multiple column families

CREATE TABLE TEST (MYKEY VARCHAR NOT NULL PRIMARY KEY, A.COL1 VARCHAR, A.COL2 VARCHAR, B.COL3 VARCHAR)

 

Use compression On disk compression improves performance on large tables

CREATE TABLE TEST (HOST VARCHAR NOT NULL PRIMARY KEY, DESCRIPTION VARCHAR) COMPRESSION='GZ'

 

Others:

 

4. Should I pool Phoenix JDBC Connections?

No, it is not necessary to pool Phoenix JDBC Connections.

Phoenix’s Connection objects are different from most other JDBC Connections due to the underlying HBase connection. The Phoenix Connection object is designed to be a thin object that is inexpensive to create. If Phoenix Connections are reused, it is possible that the underlying HBase connection is not always left in a healthy state by the previous user. It is better to create new Phoenix Connections to ensure that you avoid any potential issues.

 

参考:

http://phoenix.apache.org/installation.html

http://phoenix.apache.org/Phoenix-in-15-minutes-or-less.html

http://phoenix.apache.org/language/index.html

http://phoenix.apache.org/faq.html  

分享到:
评论

相关推荐

    cdh6.3.2 集成 Phoenix

    cdh6.3.2 适配 Phoenix; cdh6.3.2 集成 Phoenix

    Flink Phoenix connector依赖包

    flink sql读写phoenix所使用到的连接器依赖包: flink-sql-connector-phoenix-1.14-1.0.jar 使用示例: create table tab2( ID STRING, NAME STRING, PRIMARY KEY (ID) NOT ENFORCED )WITH( 'connector' = '...

    datagrip连接phoenix教程

    datagrip连接phoenix教程,DBeaver也可参考

    Phoenix/Insyde/Dell/EFI 自助修改工具 PhoenixTool 2.63 汉化版

    Phoenix/Insyde/Dell/EFI BIOS 添加、替换 SLIC 和 SLP 字 串,破解 SLI,以及更新其他模块的工具。  PhoenixTool.exe为英文原版,PhoenixTool_cn.exe为汉化版。 注:1、修改BIOS时可能需要提供RW Everything报告...

    phoenix简介

    phoenix介绍文档phoenix介绍文档phoenix介绍文档phoenix介绍文档

    springboot集成phoenix+hbase

    springboot集成phoenix+hbase 完整demo!!!!!!!

    phoenix+spring+hbase

    phoenix +hbase+spring 整合技术 phoenix +hbase+spring 整合技术 phoenix +hbase+spring 整合技术 根据需要 下载 集成的jar phoenix-core-4.13.0-HBase-0.98.jar

    Phoenix/Insyde/Dell/EFI 自助修改工具 PhoenixTool 2.54 汉化版

     Phoenix/Insyde/Dell/EFI BIOS 添加、替换 SLIC 和 SLP 字 串,破解 SLI,以及更新其他模块的工具。  PhoenixTool.exe为英文原版,PhoenixTool_cn.exe为汉化版。 注:1、修改BIOS时可能需要提供RW Everything...

    phoenix5.0.0jar包(全)

    phoenix-5.0.0-HBase-2.0-client phoenix-5.0.0-HBase-2.0-thin-client phoenix-core-5.0.0-HBase-2.0 phoenix-core-5.0.0-HBase-2.0-tests

    Phoenix BIOS Editor Pro注册机

    Phoenix BIOS Editor是Windows平台的Phoenix BIOS修改工具,支持4.0 Rel6以后版本。无须重建BIOS,BIOS ROM镜像文件可以通过本软件来编辑BIOS的相关选项。软件能自动把单个的ROM镜像文件解压成小的ROM模块,不需要源码...

    The Phoenix Project 2013.pdf

    The Phoenix Project, devops经典

    PhoenixTool190cn

    PhoenixTool190cn,PhoenixTool190cn,PhoenixTool190cn,PhoenixTool190cn,PhoenixTool190cn,PhoenixTool190cn。

    Phoenix

    Phoenix

    Phoenix/Insyde/Dell/EFI 自助修改工具 PhoenixTool 2.59 汉化版

    Phoenix/Insyde/Dell/EFI BIOS 添加、替换 SLIC 和 SLP 字 串,破解 SLI,以及更新其他模块的工具。  PhoenixTool.exe为英文原版,PhoenixTool_cn.exe为汉化版。 注:1、修改BIOS时可能需要提供RW Everything报告...

    phoenix_cdh.rar

    phoenix5.0.0-cdh6.2.0

    Phoenix/Insyde/Dell/EFI 自助修改工具 PhoenixTool 2.05 汉化版

    Phoenix/Insyde/Dell/EFI BIOS 添加、替换 SLIC 和 SLP 字 串,破解 SLI,以及更新其他模块的工具。  PhoenixTool.exe为英文原版,PhoenixTool_cn.exe为汉化版。 注:1、修改BIOS时可能需要提供RW Everything报告...

    Phoenix/Insyde/Dell/EFI 自助修改工具 PhoenixTool 2.64

    Phoenix/Insyde/Dell/EFI BIOS 添加、替换 SLIC 和 SLP 字 串,破解 SLI,以及更新其他模块的工具。  PhoenixTool.exe为英文原版,PhoenixTool_cn.exe为汉化版。 注:1、修改BIOS时可能需要提供RW Everything报告...

    Using Apache Phoenix 4.8

    根据官网整理。Using Apache Phoenix Using Apache Phoenix Using Apache Phoenix Using Apache Phoenix Using Apache Phoenix Using Apache Phoenix Using Apache Phoenix。

    Phoenix WinPhlash for X64

    1,此工具是大名鼎鼎的Phoenix WinPhlash 版本 Ver 1.0.49.0(版本有点老) 2,此工具用于在64位Win7系统上更新BIOS(不必安装32位系统或DOS也能直接更新BIOS) 3,不能用于非64位系统上,非Win7系统未经验证. 4,此工具只...

    phoenix slic edit tool

    phoenix slic edit tool

Global site tag (gtag.js) - Google Analytics