Unable to connect to hbase using phoenix jdbc driver (Can't get the locations error)

时间:2017-06-15 10:28:40

标签: hadoop jdbc hbase phoenix

I am working on hbase(1.2.6) with phoenix(4.10.0-Hbase-1.2). I am getting this error :

org.apache.hadoop.hbase.client.RetriesExhaustedException: Can't get the locations error

Below is my code through which I am trying to connect to hbase using phoenix:

Connection connection = DriverManager.getConnection("jdbc:phoenix:localhost"); 

Below is my hdfs-site.xml file where I have made some changes:
enter image description here

What changes I need to do? Please suggest..

2 个答案:

答案 0 :(得分:0)

@vrb的综合答案

Zookeeper端口是非标准端口,需要在与Connection / DriverManager一起使用的jdbc url上指定

Connection connection = DriverManager.getConnection("jdbc:phoenix:localhost:12181");

答案 1 :(得分:0)

检查" conf / regionserver"在hbase中为主机名提供文件,并使用相同的主机名连接到hbase。

    connection = DriverManager.getConnection("jdbc:phoenix:{hostname_in_regionserver_conf_file}:2181");

同时确保" phoenix-X.X.X-HBase-X.X-client.jar" jar在你的java文件的类路径中。