继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

使用Intellij-idea创建Phoenix JDBC连接

慕姐8265434
关注TA
已关注
手记 1147
粉丝 221
获赞 1064

Phoenix中我们可以使用Phoenix 的sqlline.py进行连接操作,但是界面只是控制台,查看数据很不直观,SQL语句也没有提示,我们如何在IDEA中的database工具栏中直接连接Phoenix呢,这就是此文要记录的。

使用教程

保证sqlline-thin.py host能正常连接phoenix-queryserver
假设phoenix-queryserver主机在host4.demo.com主机中

[root@storm2 bin]# ./sqlline-thin.py host4.demo.com
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/bigdata/phoenix/phoenix-5.0.0-HBase-2.0-thin-client.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/3.0.0.0-1634/hadoop/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.18/08/22 22:24:41 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Setting property: [incremental, false]
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
issuing: !connect jdbc:phoenix:thin:url=http://host4.demo.com:8765;serialization=PROTOBUF;authentication=SPNEGO none none org.apache.phoenix.queryserver.client.DriverConnecting to jdbc:phoenix:thin:url=http://host4.demo.com:8765;serialization=PROTOBUF;authentication=SPNEGOConnected to: Apache Phoenix (version unknown version)
Driver: Phoenix Remote JDBC Driver (version unknown version)
Autocommit status: trueTransaction isolation: TRANSACTION_READ_COMMITTED
Building list of tables and columns for tab-completion (set fastconnect to true to skip)...192/192 (100%) Done
Done
sqlline version 1.2.00: jdbc:phoenix:thin:url=http://host4.demo>

IDEA配置database
点击设置图标

webp

点击设置图标


新增左上角加号添加Driver
配置如下

webp

image.png


选择Class:org.apache.phoenix.queryserver.client.Driver
Additional files:添加包 phoenix-5.0.0-HBase-2.0-thin-client.jar
添加URL templates:jdbc:phoenix:thin:url=http://{host::host4.demo.com}:8765;serialization=PROTOBUF;authentication=SPNEGO;principal=hbase@DEMO.COM;keytab=/etc/security/keytabs/hbase.headless.keytab
PS:请根据自己的配置进行修改

点击OK即可进行连接查询

SUCCESS

webp

image.png



作者:dounine
链接:https://www.jianshu.com/p/1a76bbe4a33f


打开App,阅读手记
1人推荐
发表评论
随时随地看视频慕课网APP