Setting Purpose: Use Hbase to use more like relational database, Hbase itself does not have select, delete, where command, type Phoenix can realize this function.
Apache Official Address: http://phoenix.apache.org/installation.html
installation
To install a pre-built Phoenix, use these directions:download and expand the latest Phoenix-[version]-bin.tar. Add the Phoenix-[version]-server.jar to the classpath of all HBase region Server and master and remove any previous N. An easy way to does this be into the HBase Lib directory (use Phoenix-core-[version].jar for Phoenix 3.x) Rest Art HBase. Add the Phoenix-[version]-client.jar to the classpath of any Phoenix client.
Description
Download hbase consistent Phoenix copy files to hbase Lib:
Phoenix-core-4.6.0-hbase-0.98.jar
Restart HBase Cluster
Phoenix link HBase cluster needs to be zookeeper, all localhost in the following, modified to zookeeper and port hostname: bigdatasaprk:2181 (port can be omitted)
Phoenix Start client command:
Getting Started
Wanted to get started quickly? Take a look in our FAQs and Take we quick start guide here. Command Line
A Terminal interface to execute SQL from the command line are now bundled with Phoenix. To start it, execute the following from the Bin directory:
$ sqlline.py localhost
To execute SQL scripts from the command line, your can include a SQL file argument like this:
$ sqlline.py localhost. /examples/stock_symbol.sql
For more information, the manual. Loading Data
In addition, your can use the bin/psql.py to load CSV data or execute SQL scripts. For example:
$ psql.py localhost. /examples/web_stat.sql.. /examples/web_stat.csv.. /examples/web_stat_queries.sql
Other Alternatives include:using we map-reduce based CSV loader for bigger data sets Mapping a existing HBase table to A Phoenix table and using Theupsert SELECT command to populate a new table. Populating the table through our UPSERT VALUES command. SQL Client:
Through SQuirrel link Phoenix and hbase need to copy: Phoenix jar to SQuirrel
Phoenix-4.6.0-hbase-0.98-client.jar
Phoenix-4.6.0-hbase-0.98-client-minimal.jar Phoenix-core-4.6.0-hbase-0.98.jar
url:jdbc:phoenix:bigdatasaprk:2181
ClassName:org.apache.phoenix.jdbc.PhoenixDriver
If you ' d rather use a-client GUI to interact with Phoenix, download and Installsquirrel. Since Phoenix is a JDBC driver, integration with tools such as this are seamless. Here are the setup steps necessary:remove prior Phoenix-[oldversion]-client.jar from the Lib directory of SQuirrel, copy Phoenix-[newversion]-client.jar to the Lib directory (NewVersion should is compatible with the version of the Phoenix Serv Er 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:phoeni X, User name:anything, password:anything construct URL as Follows:jdbc:phoenix:zookeeper quorum server. For example, to connect to aHBase 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, are ready to run SQL queries against Phoenix.
Through SQuirrel, can issue SQL statements in SQL tab (create tables, insert data, run queries), and inspect table Metadata in the Object tab (i.e. list tables, their columns, primary keys, and types).
Samples
The best place to the tests under Src/test/java of samples are. The ones in the Endtoend package are tests demonstrating the aspects JDBC Phoenix. We also have some examples in the examples directory.