Support Questions

Find answers, ask questions, and share your expertise

Phoenix connection error while connecting to secure Hbase cluster with ERROR 103 (08004): Unable to establish connection.

avatar
Explorer

The connection string i am using to connect to hbase is of the form -

phoenix-sqlline.py zookeeper:host:/hbase:principal name:keytab

I am getting this error -

Setting property: [incremental, false]

Setting property: [isolation, TRANSACTION_READ_COMMITTED]

issuing: !connect jdbc:phoenix:zk-host:/hbase:hbase/Principal_Name@Domain:/opt/app/svc-edl-dpc-ngmp-dev/svc-edl-dpc-ngmp-dev.keytab none none org.apache.phoenix.jdbc.PhoenixDriver

Connecting to jdbc:phoenix:zk-host:/hbase:hbase/Principal_Name@Domain:/opt/app/svc-edl-dpc-ngmp-dev/svc-edl-dpc-ngmp-dev.keytab

SLF4J: Class path contains multiple SLF4J bindings.

SLF4J: Found binding in [jar:file:/opt/cloudera/parcels/CLABS_PHOENIX-4.7.0-1.clabs_phoenix1.3.0.p0.000/lib/phoenix/phoenix-4.7.0-clabs-phoenix1.3.0-client.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: Found binding in [jar:file:/opt/cloudera/parcels/CDH-5.10.0-1.cdh5.10.0.p0.41/jars/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]

Error: ERROR 103 (08004): Unable to establish connection. (state=08004,code=103)

java.sql.SQLException: ERROR 103 (08004): Unable to establish connection.

at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:422)

at org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:145)

at org.apache.phoenix.query.ConnectionQueryServicesImpl.openConnection(ConnectionQueryServicesImpl.java:392)

at org.apache.phoenix.query.ConnectionQueryServicesImpl.access$300(ConnectionQueryServicesImpl.java:211)

at org.apache.phoenix.query.ConnectionQueryServicesImpl$13.call(ConnectionQueryServicesImpl.java:2269)

at org.apache.phoenix.query.ConnectionQueryServicesImpl$13.call(ConnectionQueryServicesImpl.java:2248)

at org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:78)

at org.apache.phoenix.query.ConnectionQueryServicesImpl.init(ConnectionQueryServicesImpl.java:2248)

at org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:233)

at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.createConnection(PhoenixEmbeddedDriver.java:135)

at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:202)

at sqlline.DatabaseConnection.connect(DatabaseConnection.java:157)

at sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:203)

at sqlline.Commands.connect(Commands.java:1064)

at sqlline.Commands.connect(Commands.java:996)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:36)

at sqlline.SqlLine.dispatch(SqlLine.java:804)

at sqlline.SqlLine.initArgs(SqlLine.java:588)

at sqlline.SqlLine.begin(SqlLine.java:656)

at sqlline.SqlLine.start(SqlLine.java:398)

at sqlline.SqlLine.main(SqlLine.java:292)

Caused by: java.io.IOException: Login failure for hbase/Principal_Name@Domain from keytab /opt/app/svc-edl-dpc-ngmp-dev/svc-edl-dpc-ngmp-dev.keytab: javax.security.auth.login.LoginException: Unable to obtain password from user

at org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab(UserGroupInformation.java:962)

at org.apache.hadoop.security.SecurityUtil.login(SecurityUtil.java:243)

at org.apache.hadoop.hbase.security.User$SecureHadoopUser.login(User.java:420)

at org.apache.hadoop.hbase.security.User.login(User.java:258)

at org.apache.phoenix.query.ConnectionQueryServicesImpl.openConnection(ConnectionQueryServicesImpl.java:380)

... 22 more

Caused by: javax.security.auth.login.LoginException: Unable to obtain password from user

at com.sun.security.auth.module.Krb5LoginModule.promptForPass(Krb5LoginModule.java:897)

at com.sun.security.auth.module.Krb5LoginModule.attemptAuthentication(Krb5LoginModule.java:760)

at com.sun.security.auth.module.Krb5LoginModule.login(Krb5LoginModule.java:617)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at javax.security.auth.login.LoginContext.invoke(LoginContext.java:755)

at javax.security.auth.login.LoginContext.access$000(LoginContext.java:195)

at javax.security.auth.login.LoginContext$4.run(LoginContext.java:682)

at javax.security.auth.login.LoginContext$4.run(LoginContext.java:680)

at java.security.AccessController.doPrivileged(Native Method)

at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

at javax.security.auth.login.LoginContext.login(LoginContext.java:587)

at org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab(UserGroupInformation.java:953)

... 26 more

sqlline version 1.1.8

0: jdbc:phoenix:zk-host:/>

Command canceled.

0: jdbc:phoenix:zk-host:/>

2 REPLIES 2

avatar
Super Guru

Check the filesystem permissions on the keytab file with respect to the user that you run sqlline as. Also, compare the output of `klist` on your keytab to the principal you provided. You can try to increase the log4j level to DEBUG to get some more output.

avatar
Explorer

I did this and was able to connect to hbase.

But since I was using principal and keytab and they are credential mechanism in kerberized system then why did it matter which user I was running sqlline as.

And if I want to connect to hbase from outside tool (spotfire) using phoenix driver then how do I get the connection string.