We talked about Apache Phoenix in our previous guides and articles such as How To Install Apache HBase and List of Apache Projects For Big Data. Apache Phoenix is a massively parallel, relational database engine supporting OLTP for Hadoop using Apache HBase as store. Phoenix provides a JDBC driver that cleverly hides the noSQL store in front enabling the users to create, delete, and alter SQL tables, views, insert and delete rows and query data through SQL. Apache Phoenix started as an internal project by the company salesforce out of a need to support a higher level, SQL language. Apache Phoenix is included in the Hortonworks distribution for HDP 2.1 and above, available as part of Cloudera labs, and is part of the Hadoop ecosystem.
If we want to install Apache Phoenix, we must have install Hadoop and Hbase first. Installing Apache Phoenix itself is easy. Official website of Apache Phoenix :
1 2 3 4 5 | # http://phoenix.apache.org/index.html # https://github.com/apache/phoenix # |
Apache Phoenix have different versions with version compatibility with HBase, like :
---
Phoenix 2.x – HBase 0.94.x
Phoenix 3.x – HBase 0.94.x
Phoenix 4.x – HBase 0.98.1+
…
Phoenix 5.x – HBase 2.1+
At this moment, Phoenix 5.x is the latest version.
How To Install Apache Phoenix
We can donload the binary file from here :
1 2 3 | # http://www.eu.apache.org/dist/phoenix/ # |
This is the exact URL to get the tar ball :
1 2 3 | # http://www.eu.apache.org/dist/phoenix/apache-phoenix-5.0.0-HBase-2.0/bin/ # |
We will simply wget
it :
1 | wget http://www.eu.apache.org/dist/phoenix/apache-phoenix-5.0.0-HBase-2.0/bin/apache-phoenix-5.0.0-HBase-2.0-bin.tar.gz |
Then just extract it with this command :
1 2 3 | tar -xzvf apache-phoenix-5.0.0-HBase-2.0-bin.tar.gz ls -al |
Thereafter, we can move it into /usr/lib/phoenix
directory :
1 | sudo mv apache-phoenix-5.0.0-HBase-2.0-bin /usr/lib/phoenix |
We need to set the environment variable in ~/.bashrc
file, open it with nano :
1 | nano ~/.bashrc |
Add these lines at the bottom of that file :
1 2 3 | ## added for Apache Phonenix export PHOENIX_HOME=/usr/lib/phoenix export PATH=$PATH:$PHOENIX_HOME/bin |
Save the file and reload environment :
1 | source ~/.bashrc |
Additionally, your installation of Hadoop, HBase should have the usual environment variable in ~/.bashrc
file, like :
1 2 | export HADOOP_HOME=/path/to/hadoop-1.2.1 export HBASE_HOME=/path/to/hbase-0.94.15 |
We have to copy server.jar, client.jar jar files (real names will include Phoenix & HBase versions) into $HBASE_HOME/lib
directory. Those files located in $PHOENIX_HOME
directory i.e. /usr/lib/phoenix
.
Earlier we discussed about sqlline. We can run this command to check installation :
1 | sqlline.py localhost |
That ends this guide. Rest, you can read from the official website :
1 | https://phoenix.apache.org/Phoenix-in-15-minutes-or-less.html |