Search code examples
hivehortonworks-data-platformbeelineconnection-refusedknox-gateway

JDBC hive connection error in beeline through knox


I'm a newbie to hdp and knox.

My HDP environment description:

HDP version - 2.6

HS2 is enabled

Hive transport mode - HTTP

Knox installed via ambari

SSL is not enabled

non Kerberized instance

Issue:

I'm trying to connect to HIVE via beeline. The connection string is "!connect jdbc:hive2://:8443/;transportMode=http;httpPath=gateway//hive". the user name : admin, password: admin-password. Its throws an an error : "18/06/18 08:17:39 [main]: ERROR jdbc.HiveConnection: Error opening session org.apache.thrift.transport.TTransportException: org.apache.http.NoHttpResponseException: :8443 failed to respond" and "Error: Could not establish connection to jdbc:hive2://:8443/;transportMode=http;httpPath=gateway//hive: org.apache.http.NoHttpResponseException: :8443 failed to respond (state=08S01,code=0)".

Things I've tired:

I've tried changing the httpPath with "cliserver", "gateway/default/hive" and they didn't work.

I've tried to changing the connection url with " !connect jdbc:hive2://:10001/default;transportMode=http; httpPath=cliservice;" it worked but as it doesn't server the purpose of knox. as I'm trying to use exposed hive port.

I appreciate if anyone can help me with detailed solution to this problem.


Solution

  • You need to specify trust store and trust store password. e.g. {code} beeline -u "jdbc:hive2://:8443/;ssl=true;sslTrustStore=/gateway.jks;trustStorePassword=;transportMode=http;httpPath=gateway/default/hive" -n admin -p admin-password {code}

    Here we are assuming you have demo ldap setup (not recommended for production). Also, you need

    1. Knox host
    2. Knox truststore location (for HDP /var/lib/knox/data-x.x.x.x-xxxx/security/keystores/gateway.jks)
    3. Truststore password (default knox)
    4. The path should be gateway/default/hive

    Hope it helps.