当前位置:   article > 正文

linux安装phoenix 5.1.0(对应hbase 2.2.6)_5.1.0-hbase-2.1

5.1.0-hbase-2.1

下载

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

要根据hbase的版本来选择Phoenix的合适版本,我使用的是hbase 2.2.6,所以选择5.1.0这个版本。

Apache HBase 2.1, 2.2, 2.3, 2.4 is supported by 5.1.0.

安装

[root@harbor-n0 ~]# cd /opt/bigdata/
[root@harbor-n0 bigdata]# ls
apache-zookeeper-3.6.2-bin  hbase-2.2.6                         spark-2.4.4-bin-hadoop2.7      spark-2.4.7-bin-hadoop2.7
hadoop-2.9.2                phoenix-hbase-2.2-5.1.0-bin.tar.gz  spark-2.4.4-bin-hadoop2.7.tgz
[root@harbor-n0 bigdata]# tar xf phoenix-hbase-2.2-5.1.0-bin.tar.gz 
[root@harbor-n0 bigdata]# cd phoenix-hbase-2.2-5.1.0-bin
[root@harbor-n0 phoenix-hbase-2.2-5.1.0-bin]# ll
总用量 213912
drwxr-xr-x 3 root root      4096 1月  22 2020 bin
drwxr-xr-x 2 root root        25 1月  22 2020 docs
drwxr-xr-x 2 root root       122 1月  22 2020 examples
-rw-r--r-- 1 root root    144912 1月  22 2020 LICENSE
-rw-r--r-- 1 root root     10564 1月  22 2020 NOTICE
-rw-r--r-- 1 root root 148131425 1月  22 2020 phoenix-client-hbase-2.2-5.1.0.jar
-rw-r--r-- 1 root root   3682617 1月  22 2020 phoenix-pherf-5.1.0.jar
-rw-r--r-- 1 root root  67060244 1月  22 2020 phoenix-server-hbase-2.2-5.1.0.jar
[root@harbor-n0 phoenix-hbase-2.2-5.1.0-bin]# ls bin/
argparse-1.4.0  hadoop-metrics2-hbase.properties    hbase-site.xml    pherf-standalone.py  readme.txt
daemon.py       hadoop-metrics2-phoenix.properties  log4j.properties  phoenix_utils.py     sqlline.py
end2endTest.py  hbase-omid-client-config.yml        performance.py    psql.py              traceserver.py
[root@harbor-n0 phoenix-hbase-2.2-5.1.0-bin]# cp -a phoenix-server-hbase-2.2-5.1.0.jar ../hbase-2.2.6/lib/
[root@harbor-n0 phoenix-hbase-2.2-5.1.0-bin]# 
[root@harbor-n0 phoenix-hbase-2.2-5.1.0-bin]# scp phoenix-server-hbase-2.2-5.1.0.jar jenkins-n0:/opt/bigdata/hbase-2.2.6/lib/
phoenix-server-hbase-2.2-5.1.0.jar                                                                                         100%   64MB  76.5MB/s   00:00    
[root@harbor-n0 phoenix-hbase-2.2-5.1.0-bin]# scp phoenix-server-hbase-2.2-5.1.0.jar nfs-n0:/opt/bigdata/hbase-2.2.6/lib/
phoenix-server-hbase-2.2-5.1.0.jar                                                                                         100%   64MB 104.2MB/s   00:00    
[root@harbor-n0 phoenix-hbase-2.2-5.1.0-bin]# ls
bin  docs  examples  LICENSE  NOTICE  phoenix-client-hbase-2.2-5.1.0.jar  phoenix-pherf-5.1.0.jar  phoenix-server-hbase-2.2-5.1.0.jar
[root@harbor-n0 phoenix-hbase-2.2-5.1.0-bin]# cp $HBASE_HOME/conf/hbase-site.xml ./bin
cp:是否覆盖"./bin/hbase-site.xml"? n
[root@harbor-n0 phoenix-hbase-2.2-5.1.0-bin]# ls bin
argparse-1.4.0  hadoop-metrics2-hbase.properties    hbase-site.xml    pherf-standalone.py  readme.txt
daemon.py       hadoop-metrics2-phoenix.properties  log4j.properties  phoenix_utils.py     sqlline.py
end2endTest.py  hbase-omid-client-config.yml        performance.py    psql.py              traceserver.py
[root@harbor-n0 phoenix-hbase-2.2-5.1.0-bin]# mv bin/hbase-site.xml bin/hbase-site.xml.init
[root@harbor-n0 phoenix-hbase-2.2-5.1.0-bin]# cp $HBASE_HOME/conf/hbase-site.xml ./bin
[root@harbor-n0 phoenix-hbase-2.2-5.1.0-bin]# cp $HADOOP_HOME/
bin          etc          include      lib          libexec      LICENSE.txt  logs         NOTICE.txt   README.txt   sbin         share        
[root@harbor-n0 phoenix-hbase-2.2-5.1.0-bin]# cp $HADOOP_HOME/etc/hadoop/hdfs-site.xml ./bin
[root@harbor-n0 phoenix-hbase-2.2-5.1.0-bin]#
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40

使用

下面演示查看所有表、增加表、查询表的操作。

注意:select时需将表名加引号"t_person"

[root@cm-m0 phoenix-hbase-2.2-5.1.0-bin]# cd bin
[root@cm-m0 bin]# ls
argparse-1.4.0  hadoop-metrics2-hbase.properties    hbase-site.xml       log4j.properties     phoenix_utils.py  sqlline.py
daemon.py       hadoop-metrics2-phoenix.properties  hbase-site.xml.init  performance.py       psql.py           traceserver.py
end2endTest.py  hbase-omid-client-config.yml        hdfs-site.xml        pherf-standalone.py  readme.txt
[root@cm-m0 bin]# ./sqlline.py cm-m0,cm-n0,cm-n1:2181
Setting property: [incremental, false]
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
issuing: !connect -p driver org.apache.phoenix.jdbc.PhoenixDriver -p user "none" -p password "none" "jdbc:phoenix:cm-m0,cm-n0,cm-n1:2181"
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/bigdata/phoenix-hbase-2.2-5.1.0-bin/phoenix-client-hbase-2.2-5.1.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/bigdata/hadoop-2.9.2/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Connecting to jdbc:phoenix:cm-m0,cm-n0,cm-n1:2181
21/02/25 09:41:25 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Connected to: Phoenix (version 5.1)
Driver: PhoenixEmbeddedDriver (version 5.1)
Autocommit status: true
Transaction isolation: TRANSACTION_READ_COMMITTED
sqlline version 1.9.0
0: jdbc:phoenix:cm-m0,cm-n0,cm-n1:2181> !itables
Unknown command: itables
0: jdbc:phoenix:cm-m0,cm-n0,cm-n1:2181> !tables
+-----------+-------------+------------+--------------+---------+-----------+---------------------------+----------------+-------------+----------------+---+
| TABLE_CAT | TABLE_SCHEM | TABLE_NAME |  TABLE_TYPE  | REMARKS | TYPE_NAME | SELF_REFERENCING_COL_NAME | REF_GENERATION | INDEX_STATE | IMMUTABLE_ROWS | S |
+-----------+-------------+------------+--------------+---------+-----------+---------------------------+----------------+-------------+----------------+---+
|           | SYSTEM      | CATALOG    | SYSTEM TABLE |         |           |                           |                |             | false          | n |
|           | SYSTEM      | CHILD_LINK | SYSTEM TABLE |         |           |                           |                |             | false          | n |
|           | SYSTEM      | FUNCTION   | SYSTEM TABLE |         |           |                           |                |             | false          | n |
|           | SYSTEM      | LOG        | SYSTEM TABLE |         |           |                           |                |             | true           | 3 |
|           | SYSTEM      | MUTEX      | SYSTEM TABLE |         |           |                           |                |             | true           | n |
|           | SYSTEM      | SEQUENCE   | SYSTEM TABLE |         |           |                           |                |             | false          | n |
|           | SYSTEM      | STATS      | SYSTEM TABLE |         |           |                           |                |             | false          | n |
|           | SYSTEM      | TASK       | SYSTEM TABLE |         |           |                           |                |             | false          | n |
+-----------+-------------+------------+--------------+---------+-----------+---------------------------+----------------+-------------+----------------+---+
0: jdbc:phoenix:cm-m0,cm-n0,cm-n1:2181> 
0: jdbc:phoenix:cm-m0,cm-n0,cm-n1:2181> create table "t_person"(id VARCHAR PRIMARY KEY,"f"."id" VARCHAR,"f"."name" VARCHAR,"f"."age" VARCHAR) column_encoded_bytes=0;
No rows affected (2.478 seconds)
0: jdbc:phoenix:cm-m0,cm-n0,cm-n1:2181> !tables
+-----------+-------------+------------+--------------+---------+-----------+---------------------------+----------------+-------------+----------------+---+
| TABLE_CAT | TABLE_SCHEM | TABLE_NAME |  TABLE_TYPE  | REMARKS | TYPE_NAME | SELF_REFERENCING_COL_NAME | REF_GENERATION | INDEX_STATE | IMMUTABLE_ROWS | S |
+-----------+-------------+------------+--------------+---------+-----------+---------------------------+----------------+-------------+----------------+---+
|           | SYSTEM      | CATALOG    | SYSTEM TABLE |         |           |                           |                |             | false          | n |
|           | SYSTEM      | CHILD_LINK | SYSTEM TABLE |         |           |                           |                |             | false          | n |
|           | SYSTEM      | FUNCTION   | SYSTEM TABLE |         |           |                           |                |             | false          | n |
|           | SYSTEM      | LOG        | SYSTEM TABLE |         |           |                           |                |             | true           | 3 |
|           | SYSTEM      | MUTEX      | SYSTEM TABLE |         |           |                           |                |             | true           | n |
|           | SYSTEM      | SEQUENCE   | SYSTEM TABLE |         |           |                           |                |             | false          | n |
|           | SYSTEM      | STATS      | SYSTEM TABLE |         |           |                           |                |             | false          | n |
|           | SYSTEM      | TASK       | SYSTEM TABLE |         |           |                           |                |             | false          | n |
|           |             | t_person   | TABLE        |         |           |                           |                |             | false          | n |
+-----------+-------------+------------+--------------+---------+-----------+---------------------------+----------------+-------------+----------------+---+
0: jdbc:phoenix:cm-m0,cm-n0,cm-n1:2181>
0: jdbc:phoenix:cm-m0,cm-n0,cm-n1:2181> select * from "t_person";
+----+----+------+-----+
| ID | id | name | age |
+----+----+------+-----+
+----+----+------+-----+
No rows selected (0.062 seconds)
0: jdbc:phoenix:cm-m0,cm-n0,cm-n1:2181>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61

sql语法

Phoenix 的sql和真正的sql有一些区别,具体我们可以参照 下面的网址去编写 Phoenix 的sql语法。

官方文档地址:

https://phoenix.apache.org/language/index.html

参考链接:

安装一

安装二

基本语法演示

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/494173
推荐阅读
相关标签
  

闽ICP备14008679号