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
- 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)
- Start SQuirrel and add new driver to SQuirrel (Drivers -> New Driver)
- In Add Driver dialog box, set Name to Phoenix, and set the Example URL to jdbc:phoenix:localhost.
- Type “org.apache.phoenix.jdbc.PhoenixDriver” into the Class Name textbox and click OK to close this dialog.
- Switch to Alias tab and create the new Alias (Aliases -> New Aliases)
- In the dialog box, Name: any name, Driver: Phoenix, User Name: anything, Password: anything
- Construct URL as follows: jdbc:phoenix: zookeeper quorum server. For example, to connect to a local HBase use: jdbc:phoenix:localhost
- Press Test (which should succeed if everything is setup correctly) and press OK to close.
- 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:
-
Create indexes See faq.html#/How_do_I_create_Secondary_Index_on_a_table
-
Optimize cluster parameters See http://hbase.apache.org/book/performance.html
-
Optimize Phoenix parameters See tuning.html
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
相关推荐
1. **Arduino UNO**: Arduino UNO是Arduino系列中最常见的开发板,采用ATmega328P微控制器,易于上手,适合初学者和专业开发者进行电子项目。在六足机器人的控制中,Arduino UNO负责接收指令,处理逻辑,并通过串口...
2. **文档**:可能包含框架的使用指南、API参考、示例代码和常见问题解答。这些文档帮助新用户快速上手并熟悉框架的用法。 3. **测试用例**:预设的测试用例展示了如何编写测试脚本,涵盖了各种功能和场景,如登录...
描述中的"资源全名:phoenix_python_sdk-0.1.8.tar.gz"表明这个SDK是以tar.gz格式打包的,这是一种常见的Unix/Linux系统下的文件压缩方式,由tar命令用来打包多个文件和目录,然后用gzip压缩。Python开发者在下载此...
**Elixir + Phoenix ...总的来说,"elixir-phoenix-realworld-example-app"是一个全面的学习资源,涵盖了Elixir和Phoenix的基础到高级用法,对于希望在Web开发领域使用Elixir的人来说,这是一个不容错过的学习项目。
Phoenix BIOS是BIOS的一种常见类型,尤其在早期的个人电脑上广泛使用。"phlash16 刷BIOS工具"是一个专门用于更新或修复Phoenix BIOS的程序,它在DOS环境下运行,因为BIOS更新通常需要一个无操作系统环境以避免冲突。...
12. **教程与帮助**:DbVisualizer 5.0的帮助文档详细介绍了每个功能的用法,包括初学者教程、常见问题解答和API参考,是用户学习和解决问题的重要资源。 总之,DbVisualizer 5.0作为一款全面的数据库管理工具,其...
gem "benchmark-memory" 然后执行: $ bundle或将其自己安装为: $ gem install benchmark-memory用法在内置Benchmark和Evan Phoenix的的示例之后,使用Benchmark.memory的最常见方法是通过Benchmark.memory包装器...
通过阅读"光标兼容性api编写.html",我们可以了解到这些API的实际用法和效果,以及在不同场景下的应用。这个HTML文件可能包含了一些示例代码和测试用例,帮助开发者理解并使用提供的工具。 总的来说,这个凤凰前端...
- **主板**:ATX、BTX等常见主板类型及其支持的组件。 3. **BIOS与CMOS** - **BIOS作用**:引导加载、硬件初始化等功能。 - **CMOS设置**:调整系统时间、设置启动顺序等。 - **BIOS类型**:如AMI BIOS、...
- **作者背景**:三位作者Brian d'Foy、Tom Phoenix 和 Randal L. Schwartz均是在Perl社区享有盛誉的人物,并有着丰富的教授Perl经验。 #### 二、Perl语言的特点 - **起源**:Perl最初被设计用于Unix系统管理员的...
3. **基本用法**:展示如何启动Valgrind,监视一个简单的程序,并解释命令行选项,如`valgrind --tool=toolname your_program`。 4. **工具介绍**:列出Valgrind支持的各种工具,例如Memcheck(内存错误检测)、...
"but"作为对比连词,如"Fenghuang in Hunan doesn't look like a bird, but its name means "phoenix" in Chinese.",它表明了现实与名称含义的差异。 "or"则常用于表示选择,例如"Are you going to sit there all ...
1. "IBM Informix SQL指南语法.pdf":这可能是本书的主要章节,深入讲解了SQL语法的各种用法,包括基本语法结构、不同类型的数据类型、条件表达式、集合操作等,并可能配以实例演示和练习题,帮助读者扎实掌握基础。...