Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Phoenix connection error while secure Hbase cluster

avatar

Hi

I have configured Phoenix on top of Hbase and facing below error while I'm trying to connect using jdbc:phoenix:<Zookeeper_host_name>:<port_number>:<secured_Zookeeper_node>:<principal_name>:<HBase_headless_keytab_file> for kerberized cluster. Any needfull help is highly appericated.

Error message:

Setting property: [isolation, TRANSACTION_READ_COMMITTED]
issuing: !connect jdbc:phoenix:jdbc:phoenix:hostname.domain.com:2181:/hbase-secure:hbase@HDP.DOMAIN.COM:/etc/security/keytabs/hbase.headless.keytab none none org.apache.phoenix.jdbc.PhoenixDriver
Connecting to jdbc:phoenix:jdbc:phoenix:hostname.domain.com:2181:/hbase-secure:hbase-hdppoc@HDP.DOMAIN.COM:/etc/security/keytabs/hbase.headless.keytab
Error: ERROR 102 (08001): Malformed connection url. :jdbc:phoenix:hostname.domain.com:2181:/hbase-secure:hbase-hdppoc@HDP.DOMAIN.COM:/etc/security/keytabs/hbase.headless.keytab (state=08001,code=102)
java.sql.SQLException: ERROR 102 (08001): Malformed connection url. :jdbc:phoenix:hostname.domain.com:2181:/hbase-secure:hbase-hdppoc@HDP.DOMAIN.COM:/etc/security/keytabs/hbase.headless.keytab
        at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:386)
        at org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:145)
        at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver$ConnectionInfo.getMalFormedUrlException(PhoenixEmbeddedDriver.java:186)
        at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver$ConnectionInfo.create(PhoenixEmbeddedDriver.java:228)
        at org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:162)
        at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.connect(PhoenixEmbeddedDriver.java:132)
        at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:151)
        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:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        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)
sqlline version 1.1.8
0: jdbc:phoenix:jdbc:phoenix:hostname.>
0: jdbc:phoenix:jdbc:phoenix:hostname.> list
. . . . . . . . . . . . . . . . . . . . . . .> ;
No current connection
0: jdbc:phoenix:jdbc:phoenix:hostname.>
1 ACCEPTED SOLUTION

avatar
Super Collaborator

If you are using sqlline, you don't need "jdbc:phoenix:" prefix. It adds it automatically (that's why log shows "jdbc:phoenix:jdbc:phoenix:").

View solution in original post

10 REPLIES 10

avatar
Super Collaborator

If you are using sqlline, you don't need "jdbc:phoenix:" prefix. It adds it automatically (that's why log shows "jdbc:phoenix:jdbc:phoenix:").

avatar

@ssoldatov

Thanks, Got progressed but it's not connecting to phoenix. For a long time, it stopped at below and not moving further.

Setting property: [isolation, TRANSACTION_READ_COMMITTED]
issuing: !connect jdbc:phoenix:hostname.domain.com:2181:/hbase-secure:hbase-hdppoc@POC.HDP.DOMAIN.COM:/etc/security/keytabs/hbase.headless.keytab none none org.apache.phoenix.jdbc.PhoenixDriver
Connecting to jdbc:phoenix:hostname.domain.com:2181:/hbase-secure:hbase-hdppoc@POC.HDP.DOMAIN.COM:/etc/security/keytabs/hbase.headless.keytab
16/06/06 17:18:01 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
16/06/06 17:18:02 WARN impl.MetricsConfig: Cannot locate configuration: tried hadoop-metrics2-phoenix.properties,hadoop-metrics2.properties

avatar
Super Collaborator

Make sure that you have hbase-site.xml and core-site.xml ( from hadoop) in the classpath. You may set it by env variables HBASE_CONF_DIR and HADOOP_CONF_DIR.

Since Phoenix client works directly with HBase in the secured environment it needs keytabs for master and region servers. That’s why the hbase-site.xml is required. HBase client itself needs to know that the hadoop cluster is secured, so it needs only hadoop.security.authentication property from core-site.xml

The principal/keytab Phoenix using in the jdbc URL are for the user authentication only.

avatar
Super Guru

There may also be some issue communicating with the Master/RegionServers that is causing the client to hang. Check the HBase Master UI and make sure your RS's are online, there are no regions in transition, no "big scary red boxes", etc.

avatar

@Josh Elser

I have check HBase Master/UI, RS are working. Even I'm able to login to 'hbase shell' and see tables. I'm getting above problem when I'm trying to connect with jdbc:phoenix only.

avatar
Contributor

@Sri Bandaru

I would say, follow this page

https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.4/bk_installing_manually_book/content/validat...

jdbc:phoenix:<Zookeeper_host_name>:<port_number>:<secured_Zookeeper_node>:<principal_name>:<HBase_headless_keytab_file>

try this

!connect jdbc:phoenix:zkhostname.domain.com:2181:/hbase-secure:hbase@HDP.DOMAIN.COM:/etc/security/keytabs/hbase.headless.keytab

you had an extra "phoenix:jdbc" in the command

let me know if it worked.

avatar

@spotluri

Do I need to enter !connect option in Hbase shell same like beeline Hiveserver2 connection?. If yes, that's not working either in hbase shell or outside

avatar
Contributor

No you donot need !connect in hbase shell.

only

"hbase shell"

avatar

@spotluri

When I run !connect jdbc:phoenix:zkhostname.domain.com:2181:/hbase-secure:hbase@HDP.DOMAIN.COM:/etc/security/keytabs/hbase.headless.keytab it's throwing below error.

"-bash: !connect: event not found"