Phoenix 3.1 + HBase 0.94.21 Installation and Use

Source: Internet
Author: User

Phoenix 3.1 + HBase 0.94.21 Installation and Use

Apache Phoenix is an HBase SQL driver. Phoenix enables HBase to be accessed through JDBC and converts your SQL query to HBase scan and corresponding actions.

Compatibility:

  • Phoenix 2.x-HBase 0.94.x
  • Phoenix 3.x-HBase 0.94.x
  • Phoenix 4.x-HBase 0.98.1 +

1: Install hbase 0.94.21

Reference

2. Download phoenix 3.1.

[Bkjia @ bkjia02 ~] # Wget http://mirrors.hust.edu.cn/apache/phoenix/phoenix-3.1.0/bin/phoenix-3.1.0-bin.tar.gz
-- 22:03:44 -- http://mirrors.hust.edu.cn/apache/phoenix/phoenix-3.1.0/bin/phoenix-3.1.0-bin.tar.gz
Parsing host mirrors.hust.edu.cn... 202.114.18.160
Connecting mirrors.hust.edu.cn | 202.114.18.160 |: 80... already connected.
An HTTP request has been sent and is waiting for response... 200 OK
Length: 55480477 (53 M) [application/octet-stream]
Saving to: Export phoenix-3.1.0-bin.tar.gz"
22:16:29 (70.8 KB/s)-saved phoenix-3.1.0-bin.tar.gz "[55480477/55480477])

3: Extract

[Bkjia @ bkjia02 ~] $ Tar zxf phoenix-3.1.0-bin.tar.gz
[Bkjia @ bkjia02 ~] $ Cd phoenix-3.1.0-bin
[Bkjia @ bkjia02 phoenix-3.1.0-bin] $ ls
CHANGES common examples Hadoop1 hadoop2 LICENSE NOTICE README

4: Configuration

Reference: http://phoenix.apache.org/download.html

Phoenix 3.x is used here.

To install a pre-built phoenix, use these directions:

  • Download and expand the latest phoenix-?version=-bin.tar. Use either hadoop1 and hadoop2 artifacts which match your HBase installation.
  • Download and select hadoop1 or hadoop2 Based on the installed HBase.
  • Add the phoenix-[version]-server. jar to the classpath of every HBase region server and remove any previous version. an easy way to do this is to copy it into the HBase lib directory (use phoenix-core-[version]. jar for Phoenix 3.x)
  • Copy the phoenix-core-3.1.0.jar to the lib directory of all HBase region servers
  • Restart all region servers.
  • Restart all Hbase region servers.
  • Add the phoenix-[version]-client. jar to the classpath of any Phoenix client.
  • Phoenix client server CLASSPATH plus phoenix-3.1.0-client-hadoop1.jar

[Bkjia @ bkjia02 phoenix-3.1.0-bin] $ cd common
[Bkjia @ bkjia02 common] $ ls
Phoenix-3.1.0-client-minimal.jar phoenix-3.1.0-client-without-hbase.jar phoenix-core-3.1.0.jar
[Bkjia @ bkjia02 common] $ cp./phoenix-core-3.1.0.jar/home/bkjia/hbase-0.94.21/lib
[Bkjia @ bkjia02 common] $ scp./phoenix-core-3.1.0.jar bkjia @ bkjia01:/home/bkjia/hbase-0.94.21/lib
Phoenix-core-3.1.0.jar 100% 2178KB 2.1 MB/s
[Bkjia @ bkjia02 common] $ cd ..

In the configuration file/home/bkjia/. bash_profile

Export CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar:/home/bkjia/phoenix-3.1.0-bin/hadoop1/phoenix-3.1.0-client-hadoop1.jar

Restart HBase.

[Bkjia @ bkjia01 hbase-0.94.21] $ bin/stop-hbase.sh
Stopping hbase ................
Bkjia01: stopping zookeeper.
Bkjia02: stopping zookeeper.
[Bkjia @ bkjia01 hbase-0.94.21] $ bin/start-hbase.sh
Bkjia01: starting zookeeper, logging to/home/bkjia/hbase-0.94.21/bin/../logs/hbase-bkjia-zookeeper-bkjia01.out
Bkjia02: starting zookeeper, logging to/home/bkjia/hbase-0.94.21/bin/../logs/hbase-bkjia-zookeeper-bkjia02.out
Starting master, logging to/home/bkjia/hbase-0.94.21/logs/hbase-bkjia-master-bkjia01.out
Bkjia01: starting regionserver, logging to/home/bkjia/hbase-0.94.21/bin/../logs/hbase-bkjia-regionserver-bkjia01.out
Bkjia02: starting regionserver, logging to/home/bkjia/hbase-0.94.21/bin/../logs/hbase-bkjia-regionserver-bkjia02.out

5. startup and simple operations

[Bkjia @ bkjia02 bin] $ sqlline. py localhost
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
Issuing :! Connect jdbc: phoenix: localhost none org. apache. phoenix. jdbc. PhoenixDriver
Connecting to jdbc: phoenix: localhost
Connected to: Phoenix (version 3.1)
Driver: org. apache. phoenix. jdbc. PhoenixDriver (version 3.1)
Autocommit status: true
Transaction isolation: TRANSACTION_READ_COMMITTED
Building list of tables and columns for tab-completion (set fastconnect to true to skip )...
59/59 (100%) Done
Done
Sqlline version 1.1.2
0: jdbc: phoenix: localhost> select * from B _month
......>;
Error: ERROR 1012 (42M03): Table undefined. tableName = B _MONTH (state = 42M03, code = 1012)
0: jdbc: phoenix: localhost> create table test (a integer primary key, B integer );
No rows affected (1.534 seconds)
0: jdbc: phoenix: localhost> upsert into test values (1, 1 );
1 row affected (0.018 seconds)
0: jdbc: phoenix: localhost> upsert into test values (2, 12 );
1 row affected (0.01 seconds)
0: jdbc: phoenix: localhost> select * from test;
+ ------------ +
| A | B |
+ ------------ +
| 1 | 1 |
| 2 | 12 |
+ ------------ +
2 rows selected( 0.056 seconds)
0: jdbc: phoenix: localhost>

6. view the table test in hbase.

[Bkjia @ bkjia01 hbase-0.94.21] $ hbase shell
HBase Shell; enter 'help <RETURN> 'for list of supported commands.
Type "exit <RETURN>" to leave the HBase Shell
Version 0.94.21, r83b4a1ee9b9a2fa4c7ae1739259e041cabe8edc2, Fri Jun 27 16:14:16 UTC 2014

Hbase (main): 001: 0> list
TABLE
SYSTEM. CATALOG
SYSTEM. SEQUENCE
TEST
B _month
Mytable
5 row (s) in 0.6250 seconds

Hbase (main): 003: 0> scan 'test'
Row column + CELL
\ X80 \ x00 \ x00 \ x01 column = 0: B, timestamp = 1410534991931, value = \ x80 \ x00 \ x00 \ x01
\ X80 \ x00 \ x00 \ x01 column = 0: _ 0, timestamp = 1410534991931, value =
\ X80 \ x00 \ x00 \ x02 column = 0: B, timestamp = 1410535001115, value = \ x80 \ x00 \ x00 \ x0C
\ X80 \ x00 \ x00 \ x02 column = 0: _ 0, timestamp = 1410535001115, value =
2 row (s) in 0.0770 seconds

Hbase (main): 004: 0>

Hadoop + HBase cloud storage creation summary PDF

Regionserver startup failed due to inconsistent time between HBase nodes

Hadoop + ZooKeeper + HBase cluster configuration

Hadoop cluster Installation & HBase lab environment setup

HBase cluster configuration based on Hadoop cluster'

Hadoop installation and deployment notes-full HBase distribution mode installation

Detailed tutorial on creating HBase environment for standalone Edition

HBase details: click here
HBase: click here

This article permanently updates the link address:

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.