java - Unable to connect to Phoenix using JDBC -
i have hadoop cluster set hbase , phoenix , i'm trying connect phoenix using jdbc, sort of unable successful connection.
i want use jdbc connect using python 3.x simple test purposes set connection using java in eclipse.
i using 3rd party library (phoenixdb) python, started getting timeouts using library (as database grows). after changed variables in settings of hbase-site.xml, avoid timeout, reason didn't solve problems using 3rd party library.
so tried move on jdbc , java project instead - @ least testing.
i have following java code:
public class phoenixtest { static final string jdbc_driver = "org.apache.phoenix.jdbc.phoenixdriver"; static final string db_url1 = "jdbc:phoenix:https://xx.xx.xx.xx:8765/"; static final string db_url2 = "jdbc:phoenix:xx.xx.xx.xx:8765/"; public static void main(string[] args) { connection conn = null; statement st = null; try { class.forname("org.apache.phoenix.jdbc.phoenixdriver"); system.out.println("connecting database.."); conn = drivermanager.getconnection(db_url); st = conn.createstatement(); st.close(); conn.close(); } catch (sqlexception se) { se.printstacktrace(); } catch (exception e) { e.printstacktrace(); } { try { if (st != null) st.close(); } catch (sqlexception se2) { } try { if (conn != null) conn.close(); } catch (sqlexception se) { se.printstacktrace(); } } } system.out.println("finished!"); }
and piece of code , client.jar seems settings changed being recognized queries taking 10 minutes (600.000 ms - changed default 60.000 ms) before connection closed unlike use of phoenixdb library in connection closed after using default timeout (60.000 ms).
when use db_url2
following error:
java.sql.sqlexception: org.apache.hadoop.hbase.client.retriesexhaustedexception: failed after attempts=36, exceptions: thu apr 06 11:13:35 cest 2017, null, java.net.sockettimeoutexception: calltimeout=60000, callduration=80236: row 'system:catalog,,' on table 'hbase:meta' @ region=hbase:meta,,1.1588230740, hostname=hadoopslave,16020,1490706604328, seqnum=0
which doesn't match timeout time of 600.000 ms. when using db_url1
seems use client.jar
, timeout time have set inside of .jar
(hbase-default.xml), have set 300.000 ms, test 1 used. using db_url1
following error:
java.sql.sqlexception: org.apache.hadoop.hbase.client.retriesexhaustedexception: can't locations
which assume means can't find ip.
however never successful connection hoping have suggestions going wrong?
thanks @paulbastide managed connection using following link:
jdbc:phoenix:thin:url=http://<query_server>:<port>;serialization=protobuf
i used thin-client found phoenix distribution.
Comments
Post a Comment