SQurriel配置和客户端无法连接Phoenix问题

本文详述了在Ambari大数据管理平台中集成HBase与Phoenix的过程,包括配置步骤、常见错误分析及解决方案。重点介绍了如何在Squirrel SQL中设置Phoenix驱动,以及解决‘phoenixThe node/hbase is not in ZooKeeper’问题的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题描述:
环境:ESC中搭建的ambari大数据管理平台,添加Hbase服务时勾选Phoenix支持,Phoenix本版4.7。
step1: 添加phoenix服务器安装目录下的phoenix-[version]-client.jar到squirrel-sql安装目录lib/下
step2: 添加驱动,填写驱动类名:org.apache.phoenix.jdbc.PhoenixDriver
step3: Windown系统host文件添加主机ip映射
step4: 创建连接如下图

image.png

 

image.png

 

问题分析:
使用java连接可以打印详细问题原因

public static void main(String[] args) throws Exception {
        Class.forName("org.apache.phoenix.jdbc.PhoenixDriver");
        Connection conn = DriverManager.getConnection("jdbc:phoenix:octserver1.hadoop,octserver2.hadoop,octserver3.hadoop:2181:/hbase-unsecure");
        Statement stat = conn.createStatement();
        ResultSet rs = stat.executeQuery("select * from \"hdyc\" limit 10");
        while(rs.next()){
            String v1 = rs.getString("meter_id");
            String v2 = rs.getString("create_time");
            System.out.println(v1+" "+v2);
        }
        stat.close();
        conn.close();
}
  • 问题1

phoenix The node /hbase is not in ZooKeeper

原因:hbase-site.xml中有如下配置

<property>
      <name>zookeeper.znode.parent</name>
      <value>/hbase-unsecure</value>
</property>

解决 jdbc:phoenix:node0.example.com:2181:/hbase-unsecure

Driver配置如下:

Name:phoenix(任意取名)

Example:jdbc:phoenix:node0.example.com:2181:/hbase-unsecure

Java Class Path:phoenix-[version]-client.jar到squirrel-sql安装目录lib/下就可以,不需要去选择。

Class Name:org.apache.phoenix.jdbc.PhoenixDriver

Aliases配置

Name:phoenix (随意取)

Driver:选择之前创建的phoenix驱动。

URl:jdbc:phoenix:node0.example.com:2181:/hbase-unsecure

User Name:任意取

Password:任意取

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值