15 minutes to learn about Phoenix

Source: Internet
Author: User
Tags sql client
about Phoenix:OLTP and operational analytics for Apache Hadoop Phoenix is a open source SQL skin for HBase. We put SQL back in NoSQL Phoenix are relational layer over HBase

The following sections are translated from: Https://phoenix.apache.org/Phoenix-in-15-minutes-or-less.html Phoenix is something new.

Phoenix put on a layer of SQL for hbase. So you can use the standard JDBC API to create tables, insert data, and query data in HBase instead of using the regular HBase client API. does adding an extra layer (Phoenix) between hbase and applications affect performance.

No. Compared with the native HBase client, Phoenix performance is as good or even better, mainly through the following ways: compiling the SQL query into a native hbase scan operation. Optimize the start and end position of the scan key the parallel of the scan operation moves the computation to the data node to convert the where statement to the server-side filtering aggregation operation through the service-side hooks (co-processor)

In addition, we did some work to get some interesting improvements in performance: using level two indexing to improve query collection statistics for non-row key to improve parallelism and optimization decisions use skip scan to optimize in, like, or queries. Add salt to the row key to make the write load distribute more evenly Phoenix quickly, but why SQL?

Based on the "familiar way of using people," is there any way to make hbase easier to use? Using JDBC and SQL: Reducing the amount of code to user blocking rows that's easy to integrate with other tools, but how can SQL support my favorite hbase feature x,y,z?

You must not have paid attention to the nearest HBase meetup. SQL expresses what kind of data you want, not how you get the data. (Note: declarative and procedural). Check out my PowerPoint presentation to get the HBase features that Phoenix currently supports and plans to support. We look forward to receiving feedback, submitting issue or joining our mailing group. talking so much, I just want to start.

OK, follow our installation tutorials: Download and unzip the TAR installation package copy the corresponding version of the Phoenix Server jar package to each HBase region server's Lib directory Restart region server add Phoenix Client jar package to your hbase client. Download and set squirrel as your SQL client and you can execute ADHOC SQL queries on your hbase cluster. I don't want to download and configure anything.

No problem, you can create your own SQL script and use the command line tool to execute the script. Let's look at an example. Enter the bin directory in the Phoenix installation directory. First, create a us_opulation.sql file that contains the definition of a table:

CREATE TABLE IF not EXISTS us_population (state
      CHAR (2) isn't null, city
      VARCHAR not null,
      population bigint
  constraint my_pk PRIMARY KEY (state, city));
Create the Us_population.csv file and put the following data:
Ny,new york,8143197
ca,los angeles,3844829
il,chicago,2842518
tx,houston,2016582
, 1463281
az,phoenix,1461575
tx,san antonio,1256509 ca,san diego,1255540
CA , San jose,912332
Finally, create the query script Us_population_queries.sql:
SELECT state as ' state ', Count (city) as ' City Count ', sum (population) as "population sum" from
us_population
GROUP by state ORDER by
sum (population) DESC;
Execute the following command from the command line
./psql.py <your_zookeeper_quorum> Us_population.sql us_population.csv us_population_queries.sql

Congratulations, you've created the first Phoenix table, inserted the data and executed the query, and you've only spent about 15 minutes writing a few lines of code. What else is there?

You can use the bin/perfoemance.py script to create any number of data, and then do some queries on it. Why is it called Phoenix. is not the other item hang up then this is its next generation.

I'm sorry, we don't have time and space, we can only wait until next time to answer this question.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.