Created 12-22-2015 11:54 PM
Hi,
I have hbase server that have Phoenix installed . It is using kerberos .
phoenix-4.2.0.2.2.4.2-2-client.jar phoenix-4.2.0.2.2.4.2-2-server.jar .
I am trying to write java code where I can use phoenix jdbc driver and write a simple sql " select * from emp " .
What are the POM dependencies I need for Phoenix ?
How should My connection string look like ? I am using :
conn = DriverManager.getConnection("jdbc:" + zookeeper + ":2181/hbase-secure:principal@default_domain.com:" + keytabPath);
where principal@default_domain.com : krb.principal
Created 12-23-2015 12:03 AM
The JDBC URL for Phoenix with Kerberos is of the form:
jdbc:phoenix:<Zookeeper_host_name>:<port_number>:<secured_Zookeeper_node>:<principal_name>:<HBase_headless_keytab_file>
You should only need the phoenix-client.jar on the classpath for your Java application for dependencies. You will likely also need the Hadoop and HBase configuration file directories (/etc/hadoop/conf and /etc/hbase/conf) on your classpath for Kerberos authentication to work properly.
Created 12-23-2015 12:03 AM
The JDBC URL for Phoenix with Kerberos is of the form:
jdbc:phoenix:<Zookeeper_host_name>:<port_number>:<secured_Zookeeper_node>:<principal_name>:<HBase_headless_keytab_file>
You should only need the phoenix-client.jar on the classpath for your Java application for dependencies. You will likely also need the Hadoop and HBase configuration file directories (/etc/hadoop/conf and /etc/hbase/conf) on your classpath for Kerberos authentication to work properly.
Created 12-23-2015 02:06 AM
I get Malformed connection url error from ConnectionInfo class : PhoenixEmbeddedDriver , when i use above url suggestion , not sure what I am doing wrong . Removing credentials for obvious reasons and replacing just names of server and principal .
jdbc:phoenix:d001.unix.gsm1900.org,d002.unix.gsm1900.org,d003.unix.gsm1900.org:2181:/hbase-secure:srvc@DEFAULT_DEV.com:/home/myname/krb/hdpsrvc.keytab
Created 12-23-2015 02:43 AM
Error : It enters this loop since it has more than 3 tokens . The code is fine with first 3 tokens but not more than that.protected static ConnectionInfo create(String url) { ........
if (!isMalformedUrl) { if (tokenizer.hasMoreTokens() && !TERMINATOR.equals(token)) { isMalformedUrl = true; } else if (i > 1)
Created 12-23-2015 04:05 AM
Can you share the entire exception (with stack trace), please?
I ran the parsing code from HDP 2.2.4.2 by hand with the URL you provided and it correctly parsed out the tokens:
[d001.unix.gsm1900.org,d002.unix.gsm1900.org,d003.unix.gsm1900.org, 2181, /hbase-secure, srvc@DEFAULT_DEV.com, /home/myname/krb/hdpsrvc.keytab]
Make sure to double check that the URL you provided here is also the same as the one in your code.
Created 12-23-2015 04:09 AM
I think i am not having correct dependency , what maven dependency should i use for phoenix-client.jar . i used phoenix , incubating 4.0 version and it gives above error. When i explicitly add jar then it causes other kerberose issue , which is wrong.
Created 12-23-2015 04:29 AM
You should use the same version of the dependency that you are running your code against: 4.2.0.2.2.4.2-2. For compile-time, you would want to use phoenix-core which will transitively include the necessary artifacts.
http://repo.hortonworks.com/content/groups/public/org/apache/phoenix/phoenix-core/4.2.0.2.2.4.2-2/ is the specific version of the artifact. You can configure this as a repository in your ~/.m2/settings.xml. Follow this Maven guide for more information
https://maven.apache.org/guides/mini/guide-multiple-repositories.html
Created 12-23-2015 09:21 PM
thank you . It works now . I was missing maven dependency .
steps : in pom.xml I added
<repositories> <repository> <id>repo.hortonworks.com</id> <name>Hortonworks HDP Maven Repository</name> <url>http://repo.hortonworks.com/content/repositories/releases/</url> </repository> </repositories>
<dependency> <groupId>org.apache.phoenix</groupId> <artifactId>phoenix-core</artifactId> <version>4.2.0.2.2.4.2-2</version> </dependency>
My connection url :
conn = DriverManager.getConnection("jdbc:phoenix:" + zookeeperQuorum + ":" + port + ":" + "/hbase-secure" + ":" + krb_principal + ":" + kerberosKeytab);
Created 12-28-2015 06:15 PM
Hey Guys,
I get below error when i use keytab path as below for phoenix jdbc connection . Can anyone please help me here . I have keytab file locally on my laptop.
keytab.path=C\:\\Users\\VBorhad\\krbProperties\\hdpsrvc.keytab
Error :
java.sql.SQLException: ERROR 102 (08001): Malformed connection url. jdbc:phoenix:p006.unix.gsm1900.org,p001.unix.gsm1900.org,p002.unix.gsm1900.org,p003.unix.gsm1900.org:2181:/hbase-secure:srvc@HDP_EIT_DEV.com:C:\Users\VBorhad\krbProperties\hdpsrvc.keytab at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:337) at org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:133)
Created 12-28-2015 06:18 PM
I saw you had already asked this question over at https://community.hortonworks.com/questions/7887/phoenix-throws-malformed-url-error-when-keytab-pat..... Let's address this issue there. Thanks.