gpt4 book ai didi

java - 无法通过 phoenix 连接到 hbase

转载 作者:搜寻专家 更新时间:2023-11-01 03:39:28 26 4
gpt4 key购买 nike

我正在尝试连接 通过 :首先,我将 phoenix-2.jar 添加到 hbase lib 目录。然后重启区域服务器,然后在netbeans中创建一个项目并将phoenic-2-client.jar添加到项目的类路径中。然后为 hbase 和 phoenix 添加以下行到 hbase.site.xml 中。

    <property>
<name>hbase.master</name>
<value>23.201.00.100:60000</value>
<description>The host and port the HBase master runs at.
</description>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2222</value>
<description>Property from ZooKeeper's config zoo.cfg.
The port at which the clients will connect.
</description>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>rs1.example.com,rs2.example.com,rs3.example.com,rs4.example.com,rs5.example.com</value>
<description>Comma separated list of servers in the ZooKeeper Quorum.
For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com".
By default this is set to localhost for local and pseudo-distributed modes
of operation. For a fully-distributed setup, this should be set to a full
list of ZooKeeper quorum servers. If HBASE_MANAGES_ZK is set in hbase-env.sh
this is the list of servers which we will start/stop ZooKeeper on.
</description>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/usr/local/zookeeper</value>
<description>Property from ZooKeeper's config zoo.cfg.
The directory where the snapshot is stored.
</description>
</property>

我的hbase是pseodo分布式模式,最后在netbeans中写了如下代码连接hbase:

 Connection conn;
Properties prop = new Properties();
try{
Class.forName("com.salesforce.phoenix.jdbc.PhoenixDriver");
conn = DriverManager.getConnection("jdbc:phoenix:rs1.example.com,rs2.example.com,rs3.example.com,rs4.example.com,rs5.example.com:2222:hdfs://localhost:8020/hbase");
System.out.println(conn);

但显示此错误:

    java.sql.SQLException: ERROR 102 (08001): Malformed connection url. jdbc:phoenix:rs1.example.com,rs2.example.com,rs3.example.com,rs4.example.com,rs5.example.com:2222:hdfs://localhost:8020/hbase
at com.salesforce.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:146)
at com.salesforce.phoenix.jdbc.PhoenixEmbeddedDriver$ConnectionInfo.create(PhoenixEmbeddedDriver.java:206)
at com.salesforce.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:78)
at com.salesforce.phoenix.jdbc.PhoenixEmbeddedDriver.connect(PhoenixEmbeddedDriver.java:115)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:233)
at hbase.phoenix.HbasePhoenix.main(HbasePhoenix.java:30)
BUILD SUCCESSFUL (total time: 2 seconds)

请指导我..

最佳答案

检查这 link有帮助。

Phoenix 中所述项目,jdbc 连接 url 应该是这样的:jdbc:phoenix:zookeeper1:port,zookeeper2:port

zookeeper 默认监听 2181 端口。

谢谢

关于java - 无法通过 phoenix 连接到 hbase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18353021/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com