【问题标题】:Unable to connect to hbase using phoenix jdbc driver (Can't get the locations error)无法使用 phoenix jdbc 驱动程序连接到 hbase(无法获取位置错误)
【发布时间】:2017-11-17 19:24:53
【问题描述】:

我正在使用 phoenix(4.10.0-Hbase-1.2) 开发 hbase(1.2.6)。 我收到此错误:

org.apache.hadoop.hbase.client.RetriesExhaustedException:无法获取位置错误

下面是我尝试使用 phoenix 连接到 hbase 的代码:

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

下面是我的 hdfs-site.xml 文件,我在其中做了一些更改:

我需要做哪些改变?请建议..

【问题讨论】:

  • 在您的 jdbc url 中添加 localhost:2181 或 localhost:12181 以指向 zookeeper,以便它可以找到您的 HBase+Phoenix 协处理器?
  • 是的,我试过像 Connection connection = DriverManager.getConnection("jdbc:phoenix:localhost:12181");它现在正在工作。

标签: hadoop jdbc hbase phoenix


【解决方案1】:

检查 hbase 中的“conf/regionserver”文件中的主机名,并使用相同的主机名连接到 hbase。

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

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

【讨论】:

    【解决方案2】:

    与@vrb 的组合答案

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-24
      • 2017-06-23
      • 2014-07-28
      • 1970-01-01
      • 2019-12-02
      相关资源
      最近更新 更多