李斯特 发表于 2017-12-24 22:33:32

Apache版Phoenix的安装(图文详解)

  同时,修改apache-phoenix-4.10.0-HBase-0.98-bin/bin/下的psql.py和sqlline.py两个文件的权限为777。

  5、验证 Phoenix 是否安装成功
  命令格式:./sqlline.sh <hbase.zookeeper.quorum>
  其中,hbase.zookeeper.quorum 是 HBase 集群的 Zookeeper 队列,对应 IP/Hostname 逗号分割的列表。
  在phoenix的安装目录下,输入命令启动




bin/sqlline.py master




$ pwd
/home/hadoop/app/apache-phoenix-4.10.0-HBase-0.98-bin
$ ls
bin                                          phoenix-flume-4.10.0-HBase-0.98-tests.jar    phoenix-queryserver-4.10.0-HBase-0.98.jar
examples                                     phoenix-hive-4.10.0-HBase-0.98.jar         phoenix-queryserver-4.10.0-HBase-0.98-sources.jar
LICENSE                                    phoenix-hive-4.10.0-HBase-0.98-sources.jar   phoenix-queryserver-4.10.0-HBase-0.98-tests.jar
NOTICE                                       phoenix-hive-4.10.0-HBase-0.98-tests.jar   phoenix-queryserver-client-4.10.0-HBase-0.98.jar
phoenix-4.10.0-HBase-0.98-client.jar         phoenix-kafka-4.10.0-HBase-0.98.jar          phoenix-queryserver-client-4.10.0-HBase-0.98-sources.jar
phoenix-4.10.0-HBase-0.98-hive.jar         phoenix-kafka-4.10.0-HBase-0.98-minimal.jarphoenix-queryserver-client-4.10.0-HBase-0.98-tests.jar
phoenix-4.10.0-HBase-0.98-pig.jar            phoenix-kafka-4.10.0-HBase-0.98-sources.jarphoenix-spark-4.10.0-HBase-0.98.jar
phoenix-4.10.0-HBase-0.98-queryserver.jar    phoenix-kafka-4.10.0-HBase-0.98-tests.jar    phoenix-spark-4.10.0-HBase-0.98-sources.jar
phoenix-4.10.0-HBase-0.98-server.jar         phoenix-pherf-4.10.0-HBase-0.98.jar          phoenix-spark-4.10.0-HBase-0.98-tests.jar
phoenix-4.10.0-HBase-0.98-thin-client.jar    phoenix-pherf-4.10.0-HBase-0.98-minimal.jarphoenix-tracing-webapp-4.10.0-HBase-0.98.jar
phoenix-core-4.10.0-HBase-0.98.jar         phoenix-pherf-4.10.0-HBase-0.98-sources.jarphoenix-tracing-webapp-4.10.0-HBase-0.98-runnable.jar
phoenix-core-4.10.0-HBase-0.98-sources.jar   phoenix-pherf-4.10.0-HBase-0.98-tests.jar    phoenix-tracing-webapp-4.10.0-HBase-0.98-sources.jar
phoenix-core-4.10.0-HBase-0.98-tests.jar   phoenix-pig-4.10.0-HBase-0.98.jar            phoenix-tracing-webapp-4.10.0-HBase-0.98-tests.jar
phoenix-flume-4.10.0-HBase-0.98.jar          phoenix-pig-4.10.0-HBase-0.98-sources.jar    README
phoenix-flume-4.10.0-HBase-0.98-sources.jarphoenix-pig-4.10.0-HBase-0.98-tests.jar
$ bin/sqlline.py master
  当然,大家也可以跟我这样,做个软连接。
  如果大家这里,遇到这个问题




Traceback (most recent call last):
File "./sqlline.py", line 27, in <module>
import argparse
ImportError: No module named argparse
  则,解决办法

安装Phoenix时./sqlline.py执行报错File "./sqlline.py", line 27, in <module> import argparse ImportError: No module named argparse解决办法(图文详解)
  这里,建议搭建,你若如跟我一样(master、slave1和slave2)集群的话,zookeeper也是都安装在master、slave1和slave2上,则
  使用 sqlline.py 脚本来启动,参数是 zookeeper 集群中各个节点的 hostname ,多个使用逗号隔开,另外端口为 2181




$ pwd
/home/hadoop/app/apache-phoenix-4.8.2-HBase-0.98-bin
$ bin/sqlline.py master,slave1,slave2:2181
Setting property:
Setting property:
issuing: !connect jdbc:phoenix:master,slave1,slave2:2181 none none org.apache.phoenix.jdbc.PhoenixDriver
Connecting to jdbc:phoenix:master,slave1,slave2:2181
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
SLF4J: Found binding in
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
17/08/22 09:07:40 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Connected to: Phoenix (version 4.8)
Driver: PhoenixEmbeddedDriver (version 4.8)
Autocommit status: true
Transaction isolation: TRANSACTION_READ_COMMITTED
Building list of tables and columns for tab-completion (set fastconnect to true to skip)...
86/86 (100%) Done
Done
sqlline version 1.1.9
0: jdbc:phoenix:master,slave1,slave2:2181>
  如果出现上面的结果,说明 Phoenix 安装成功。
  
6、 罗列所有表
在客户端执行!tables 命令,罗列所有表到客户端界面





0: jdbc:phoenix:master,slave1,slave2: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_TEN |
+------------+--------------+-------------+---------------+----------+------------+----------------------------+-----------------+--------------+-----------------+---------------+-----------+
|            | SYSTEM       | CATALOG   | SYSTEM TABLE|          |            |                            |               |            | false         | null          | false   |
|            | SYSTEM       | FUNCTION    | SYSTEM TABLE|          |            |                            |               |            | false         | null          | false   |
|            | SYSTEM       | SEQUENCE    | SYSTEM TABLE|          |            |                            |               |            | false         | null          | false   |
|            | SYSTEM       | STATS       | SYSTEM TABLE|          |            |                            |               |            | false         | null          | false   |
+------------+--------------+-------------+---------------+----------+------------+----------------------------+-----------------+--------------+-----------------+---------------+-----------+
0: jdbc:phoenix:master,slave1,slave2:2181>
  注意: 通过该客户端展示出来的表都是通过 Phoenix 客户端创建的,通过其他方式创建的表在此处不显示。

  若要退出,则
  Phoenix早期版本如(2.11版本)需输入!quilt才可退出,目前高版本已改为!exit命令




0: jdbc:phoenix:master> !exit
Closing: org.apache.phoenix.jdbc.PhoenixConnection
$
  参考博客

HBase 4、Phoenix安装和Squirrel安装
   phoenix-4.8.1-HBase-1.2安装(详细图文)


欢迎大家,加入我的微信公众号:大数据躺过的坑   免费给分享







  同时,大家可以关注我的个人博客:
  http://www.cnblogs.com/zlslch/ 和http://www.cnblogs.com/lchzls/
  人生苦短,我愿分享。本公众号将秉持活到老学到老学习无休止的交流分享开源精神,汇聚于互联网和个人学习工作的精华干货知识,一切来于互联网,反馈回互联网。
  目前研究领域:大数据、机器学习、深度学习、人工智能、数据挖掘、数据分析。 语言涉及:Java、Scala、Python、Shell、Linux等 。同时还涉及平常所使用的手机、电脑和互联网上的使用技巧、问题和实用软件。 只要你一直关注和呆在群里,每天必须有收获
  以及对应本平台的QQ群:161156071(大数据躺过的坑)


页: [1]
查看完整版本: Apache版Phoenix的安装(图文详解)