SQurriel客户端无法连接Phoenix问题
问题描述:
环境: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
问题分析:
使用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:octserver1.hadoop,octserver2.hadoop,octserver3.hadoop:2181:/hbase-unsecure
- 问题2
Caused by: org.apache.hadoop.hbase.MasterNotRunningException: com.google.protobuf.ServiceException: org.apache.hadoop.net.ConnectTimeoutException: 10000 millis timeout while waiting for channel to be ready for connect. ch : java.nio.channels.SocketChannel[connection-pending remote=octserver1/xxx.xxx.xxx.xxx:16000]
解决:安全组开放16000端口