How to use DBVisualizer to connect to Hbase using Apache Phoenix

本文介绍如何通过DBVisualizer连接Apache Phoenix访问HBase。首先需在DBVisualizer中添加Phoenix驱动,然后根据不同集群类型配置连接字符串。对于非Kerberos集群,直接配置连接字符串即可;对于Kerberos集群,则需要额外准备配置文件并设置参数。
How to use DBVisualizer to connect to Hbase using Apache Phoenix
Article

DB Visualizer is a popular free tool that allows developers to organize development tools for RDBMS development. With Apache Phoenix, that allows SQL like capability for Hbase, we can use DBVisualizer to connect to Apache Phoenix layer for HBase.

Verified with following versions.

  • DBVisualizer version 9.2.12
  • hbase-client-1.1.2.2.3.2.0-2950.jar
  • phoenix-4.4.0.2.3.2.0-2950-client.jar

First Add Phoenix driver to DBVisualizer. In DBVisualizer, go to Tools->Driver Manager and add a new driver. Add both hbase-client and phoenix-client jar. This will add a new Phoenix driver.

1. Connecting to Non-Kerberos cluster

To connect to a Non-Kerberos cluster, use jdbc:phoenix:<zookeeper host>:<zookeeper port>:<hbase_z_node> as connection string where hbase_z_node is :/hbase by default.

2. Connecting to Kerberos cluster using cached ticket

To connect to a Kerberos cluster,

a. add following files to DBVisualizer resources directory.

  • hdfs-site.xml
  • hbase-site.xml
  • core-site.xml

b. Copy krb5.conf file to local workstation.

c. Create a jaas file with following entry.


  
  1. Client {
  2. com.sun.security.auth.module.Krb5LoginModule required useTicketCache=true renewTicket=true
  3. serviceName="zookeeper";};

Modify dbvisgui.bat file to add following parameters for launching DBVisualizer


  
  1. -Djava.security.auth.login.config="<path-to-jaas-file>" -Djava.security.krb5.conf="<path-to-krb5-file>"

d. Connection string for cached keytab will be

jdbc:phoenix:<zookeeper host>:<zookeeper port>:/hbase-secure:<path-to-jaas file>

3. Connecting to Kerberos cluster using keytab

a. add following files to DBVisualizer resources directory.

  • hdfs-site.xml
  • hbase-site.xml
  • core-site.xml

b. Copy krb5.conf file to local workstation.

c. copy keytab file use for connecting to Hbase.

d. Create a jaas file with following entry.


  
  1. Client {
  2. com.sun.security.auth.module.Krb5LoginModule
  3. requireduseTicketCache=false
  4. useKeytab=true
  5. serviceName="zookeeper";};

Connection string for this case will be

jdbc:phoenix:<zookeeper host>:<zookeeper port>:/hbase-secure:<Principal>:<path-to-keytab>

Sample connection string

jdbc:phoenix:host0001:2181:/hbase-secure:<principal>:\users\z_hadoop_test.keytab

Test your connection !






转载于:https://www.cnblogs.com/jins-note/p/9513470.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值