Phoenix5.0的部署
- 官网下载编译好的二进制包
-
上传并解压到指定目录, 再修改目录名称
tar -zxvf apache-phoenix-5.0.0-HBase-2.0-bin.tar.gz -C /opt/ronnie/ cd /opt/ronnie/ mv apache-phoenix-5.0.0-HBase-2.0-bin/ phoenix-5.0.0
-
将
phoenix-5.0.0-HBase-2.0-server.jar
这个jar包拷贝到每一台机器的hbase的lib目录下-
进入Phoenix目录, 你会发现该目录下有多个jar包
root@node01:/opt/ronnie# cd phoenix-5.0.0/ root@node01:/opt/ronnie/phoenix-5.0.0# ll total 474596 drwxr-xr-x 5 502 staff 4096 6月 27 2018 ./ drwxr-xr-x 12 root root 4096 12月 27 10:15 ../ drwxr-xr-x 4 502 staff 4096 12月 27 10:14 bin/ drwxr-xr-x 3 502 staff 4096 12月 27 10:14 examples/ -rw-r--r-- 1 502 staff 144163 6月 27 2018 LICENSE -rw-r--r-- 1 502 staff 10509 6月 27 2018 NOTICE -rw-r--r-- 1 502 staff 135109092 6月 27 2018 phoenix-5.0.0-HBase-2.0-client.jar -rw-r--r-- 1 502 staff 110858350 6月 27 2018 phoenix-5.0.0-HBase-2.0-hive.jar -rw-r--r-- 1 502 staff 137968668 6月 27 2018 phoenix-5.0.0-HBase-2.0-pig.jar -rw-r--r-- 1 502 staff 7931132 6月 27 2018 phoenix-5.0.0-HBase-2.0-queryserver.jar -rw-r--r-- 1 502 staff 41800313 6月 27 2018 phoenix-5.0.0-HBase-2.0-server.jar -rw-r--r-- 1 502 staff 34159398 6月 27 2018 phoenix-5.0.0-HBase-2.0-thin-client.jar -rw-r--r-- 1 502 staff 4317285 6月 27 2018 phoenix-core-5.0.0-HBase-2.0.jar -rw-r--r-- 1 502 staff 2582830 6月 27 2018 phoenix-core-5.0.0-HBase-2.0-sources.jar -rw-r--r-- 1 502 staff 2464127 6月 27 2018 phoenix-core-5.0.0-HBase-2.0-tests.jar -rw-r--r-- 1 502 staff 47912 6月 27 2018 phoenix-flume-5.0.0-HBase-2.0.jar -rw-r--r-- 1 502 staff 30171 6月 27 2018 phoenix-flume-5.0.0-HBase-2.0-sources.jar -rw-r--r-- 1 502 staff 37284 6月 27 2018 phoenix-flume-5.0.0-HBase-2.0-tests.jar -rw-r--r-- 1 502 staff 139358 6月 27 2018 phoenix-hive-5.0.0-HBase-2.0.jar -rw-r--r-- 1 502 staff 85153 6月 27 2018 phoenix-hive-5.0.0-HBase-2.0-sources.jar -rw-r--r-- 1 502 staff 78698 6月 27 2018 phoenix-hive-5.0.0-HBase-2.0-tests.jar -rw-r--r-- 1 502 staff 27314 6月 27 2018 phoenix-kafka-5.0.0-HBase-2.0.jar -rw-r--r-- 1 502 staff 701717 6月 27 2018 phoenix-kafka-5.0.0-HBase-2.0-minimal.jar -rw-r--r-- 1 502 staff 17292 6月 27 2018 phoenix-kafka-5.0.0-HBase-2.0-sources.jar -rw-r--r-- 1 502 staff 23673 6月 27 2018 phoenix-kafka-5.0.0-HBase-2.0-tests.jar -rw-r--r-- 1 502 staff 22960 6月 27 2018 phoenix-load-balancer-5.0.0-HBase-2.0.jar -rw-r--r-- 1 502 staff 13043 6月 27 2018 phoenix-load-balancer-5.0.0-HBase-2.0-tests.jar -rw-r--r-- 1 502 staff 166993 6月 27 2018 phoenix-pherf-5.0.0-HBase-2.0.jar -rw-r--r-- 1 502 staff 3649883 6月 27 2018 phoenix-pherf-5.0.0-HBase-2.0-minimal.jar -rw-r--r-- 1 502 staff 117898 6月 27 2018 phoenix-pherf-5.0.0-HBase-2.0-sources.jar -rw-r--r-- 1 502 staff 71056 6月 27 2018 phoenix-pherf-5.0.0-HBase-2.0-tests.jar -rw-r--r-- 1 502 staff 45806 6月 27 2018 phoenix-pig-5.0.0-HBase-2.0.jar -rw-r--r-- 1 502 staff 29760 6月 27 2018 phoenix-pig-5.0.0-HBase-2.0-sources.jar -rw-r--r-- 1 502 staff 46425 6月 27 2018 phoenix-pig-5.0.0-HBase-2.0-tests.jar -rw-r--r-- 1 502 staff 30825 6月 27 2018 phoenix-queryserver-5.0.0-HBase-2.0.jar -rw-r--r-- 1 502 staff 22595 6月 27 2018 phoenix-queryserver-5.0.0-HBase-2.0-sources.jar -rw-r--r-- 1 502 staff 59481 6月 27 2018 phoenix-queryserver-5.0.0-HBase-2.0-tests.jar -rw-r--r-- 1 502 staff 16785 6月 27 2018 phoenix-queryserver-client-5.0.0-HBase-2.0.jar -rw-r--r-- 1 502 staff 13491 6月 27 2018 phoenix-queryserver-client-5.0.0-HBase-2.0-sources.jar -rw-r--r-- 1 502 staff 10914 6月 27 2018 phoenix-queryserver-client-5.0.0-HBase-2.0-tests.jar -rw-r--r-- 1 502 staff 88764 6月 27 2018 phoenix-spark-5.0.0-HBase-2.0.jar -rw-r--r-- 1 502 staff 3569 6月 27 2018 phoenix-spark-5.0.0-HBase-2.0-javadoc.jar -rw-r--r-- 1 502 staff 25584 6月 27 2018 phoenix-spark-5.0.0-HBase-2.0-sources.jar -rw-r--r-- 1 502 staff 127007 6月 27 2018 phoenix-spark-5.0.0-HBase-2.0-tests.jar -rw-r--r-- 1 502 staff 16290 6月 27 2018 phoenix-tracing-webapp-5.0.0-HBase-2.0.jar -rw-r--r-- 1 502 staff 2730675 6月 27 2018 phoenix-tracing-webapp-5.0.0-HBase-2.0-runnable.jar -rw-r--r-- 1 502 staff 11826 6月 27 2018 phoenix-tracing-webapp-5.0.0-HBase-2.0-sources.jar -rw-r--r-- 1 502 staff 8043 6月 27 2018 phoenix-tracing-webapp-5.0.0-HBase-2.0-tests.jar drwxr-xr-x 6 502 staff 4096 12月 27 10:14 python/ -rw-r--r-- 1 502 staff 1150 6月 27 2018 README.md
-
将与HBase服务端关联的jar包拷贝到每一台机器的hbase的lib目录下
cp phoenix-5.0.0-HBase-2.0-server.jar /opt/ronnie/hbase-2.0.6/lib/ scp phoenix-5.0.0-HBase-2.0-server.jar root@node02:/opt/ronnie/hbase-2.0.6/lib/ scp phoenix-5.0.0-HBase-2.0-server.jar root@node03:/opt/ronnie/hbase-2.0.6/lib/ scp phoenix-5.0.0-HBase-2.0-server.jar root@node04:/opt/ronnie/hbase-2.0.6/lib/ scp phoenix-5.0.0-HBase-2.0-server.jar root@node05:/opt/ronnie/hbase-2.0.6/lib/
-
-
启动HBase
-
启动Zookeeper集群
zkServer.sh start
-
启动hdfs和yarn
start-dfs.sh start-yarn.sh
-
启动HBase
start-hbase.sh
-
-
验证Phoenix是否部署成功
root@node01:~# cd /opt/ronnie/phoenix-5.0.0/bin/ root@node01:/opt/ronnie/phoenix-5.0.0/bin# ./sqlline.py node03,node04,node05:2181
-
ps: 我的Zookeeper集群是在node03, node04, node05上的。
-
执行结果
root@node01:/opt/ronnie/phoenix-5.0.0/bin# ./sqlline.py node03,node04,node05:2181 Setting property: [incremental, false] Setting property: [isolation, TRANSACTION_READ_COMMITTED] issuing: !connect jdbc:phoenix:node03,node04,node05:2181 none none org.apache.phoenix.jdbc.PhoenixDriver Connecting to jdbc:phoenix:node03,node04,node05:2181 SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/opt/ronnie/phoenix-5.0.0/phoenix-5.0.0-HBase-2.0-client.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/opt/ronnie/hadoop-3.1.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. 19/12/27 10:38:53 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable Connected to: Phoenix (version 5.0) Driver: PhoenixEmbeddedDriver (version 5.0) Autocommit status: true Transaction isolation: TRANSACTION_READ_COMMITTED Building list of tables and columns for tab-completion (set fastconnect to true to skip)... 133/133 (100%) Done Done sqlline version 1.2.0 0: jdbc:phoenix:node03,node04,node05:2181> !tables +------------+--------------+-------------+---------------+----------+------------+----------------------------+-----------------+--------------+-----------------+---------------+---------------+-----------------+------------+-------------+----------------+------------+ | TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_NAME | SELF_REFERENCING_COL_NAME | REF_GENERATION | INDEX_STATE | IMMUTABLE_ROWS | SALT_BUCKETS | MULTI_TENANT | VIEW_STATEMENT | VIEW_TYPE | INDEX_TYPE | TRANSACTIONAL | IS_NAMESPA | +------------+--------------+-------------+---------------+----------+------------+----------------------------+-----------------+--------------+-----------------+---------------+---------------+-----------------+------------+-------------+----------------+------------+ | | SYSTEM | CATALOG | SYSTEM TABLE | | | | | | false | null | false | | | | false | false | | | SYSTEM | FUNCTION | SYSTEM TABLE | | | | | | false | null | false | | | | false | false | | | SYSTEM | LOG | SYSTEM TABLE | | | | | | true | 32 | false | | | | false | false | | | SYSTEM | SEQUENCE | SYSTEM TABLE | | | | | | false | null | false | | | | false | false | | | SYSTEM | STATS | SYSTEM TABLE | | | | | | false | null | false | | | | false | false | +------------+--------------+-------------+---------------+----------+------------+----------------------------+-----------------+--------------+-----------------+---------------+---------------+-----------------+------------+-------------+----------------+------------+ 0: jdbc:phoenix:node03,node04,node05:2181>
- 能进入sql界面并能查到表说明已经安装部署成功
-
-
写个简单demo
-
创建person表, 插入值, 选择所有
0: jdbc:phoenix:node03,node04,node05:2181> create table person (id integer not null primary key,name varchar,age integer); No rows affected (0.826 seconds) 0: jdbc:phoenix:node03,node04,node05:2181> upsert into person values (1,'ronnie',22); 1 row affected (0.058 seconds) 0: jdbc:phoenix:node03,node04,node05:2181> upsert into person values (2,'alex',18); 1 row affected (0.008 seconds) 0: jdbc:phoenix:node03,node04,node05:2181> select * from person; +-----+---------+------+ | ID | NAME | AGE | +-----+---------+------+ | 1 | ronnie | 22 | | 2 | alex | 18 | +-----+---------+------+ 2 rows selected (0.027 seconds)
-
此时, 在HBase上查看下person表
hbase(main):001:0> list TABLE PERSON SYSTEM.CATALOG SYSTEM.FUNCTION SYSTEM.LOG SYSTEM.MUTEX SYSTEM.SEQUENCE SYSTEM.STATS stu student student_namespace:student_table www.baidu.com20170630 www.qq.com20170630 12 row(s) Took 0.2846 seconds => ["PERSON", "SYSTEM.CATALOG", "SYSTEM.FUNCTION", "SYSTEM.LOG", "SYSTEM.MUTEX", "SYSTEM.SEQUENCE", "SYSTEM.STATS", "stu", "student", "student_namespace:student_table", "www.baidu.com20170630", "www.qq.com20170630"] hbase(main):002:0> scan 'PERSON' ROW COLUMN+CELL \x80\x00\x00\x01 column=0:\x00\x00\x00\x00, timestamp=1577415599466, value=x \x80\x00\x00\x01 column=0:\x80\x0B, timestamp=1577415599466, value=ronnie \x80\x00\x00\x01 column=0:\x80\x0C, timestamp=1577415599466, value=\x80\x00\x00\x16 \x80\x00\x00\x02 column=0:\x00\x00\x00\x00, timestamp=1577415698218, value=x \x80\x00\x00\x02 column=0:\x80\x0B, timestamp=1577415698218, value=alex \x80\x00\x00\x02 column=0:\x80\x0C, timestamp=1577415698218, value=\x80\x00\x00\x12 2 row(s) Took 0.0833 seconds
- 会发现person表只有一个rowkey, 有三列,默认列族名称是0, 这里rowkey,列族和列都是Phoenix处理过的。
- hbase shell可以把Phoenix的表都列出来,而且都是可以操作的。
-