Created 08-08-2017 07:20 PM
Transport mode: http
hive server 2 running port 10001, hive service check from ambari passed succesfully
url : "jdbc:hive2://hostname:port/default;transportMode=http;httppath=cliservice"
able to login through hive cli .
When i try with beeline i get an error saying
Error: Could not open client transport with JDBC Uri: jdbc:hive2://host:port/defaultt;transportMode=http;httpPath=cliservice: Could not create http connection to jdbc:hive2://host:port/default;transportMode=http;httpPath=cliservice. HTTP Response code: 401 (state=08S01,code=0)
Can some one please shed some light of what is happening here. How should i solve this. I checked hive server 2 logs but there is nothing related to this.
Created 08-08-2017 08:04 PM
Is SSL enabled ?
Is this a Kerberized Cluster ?
If answer to any of the above questions is yes, then the connection url will change.
Also I hope you are pre-pending '!connect' before your connection URL in order to connect using beeling.
Created 08-08-2017 08:41 PM
The below output is for a keberized cluster you should replace the principal and REALM with the correct values derived from
$ klist -ket /etc/security/keytabs/hive.keytab Keytab name: FILE:/etc/security/keytabs/hive.keytab KVNO Timestamp Principal ---- ----------------- -------------------------------------------------------- 1 12/28/16 22:25:31 hive-{hostname}@REALM.COM (des3-cbc-sha1) 1 12/28/16 22:25:31 hive-{hostname}@REALM.COM (aes128-cts-hmac-sha1-96) 1 12/28/16 22:25:31 hive-{hostname}@REALM.COM (arcfour-hmac) 1 12/28/16 22:25:31 hive-{hostname}@REALM.COM (des-cbc-md5) 1 12/28/16 22:25:31 hive-{hostname}@REALM.COM (aes256-cts-hmac-sha1-96)
To see if you grabbed a validate kerberos ticket
[hive@{hostname} ~]$ klist Ticket cache: FILE:/tmp/krb5cc_507 Default principal: hive-{hostname}@REALM.COM Valid starting Expires Service principal 12/28/16 22:57:11 12/29/16 22:57:11 krbtgt/REALM.COM@REALM.COM renew until 12/28/16 22:57:11 12/28/16 22:57:11 12/29/16 22:57:11 HTTP/{hostname}.REALM.COM@renew until 12/28/16 22:57:11 12/28/16 22:57:11 12/29/16 22:57:11 HTTP/{hostname}.REALM.COM@REALM.COM renew until 12/28/16 22:57:11
Then use the above to connect and just PRESS enter at the username and password prompt
Beeline version 1.2.1000.2.5.3.0-37 by Apache Hive beeline> ! connect jdbc:hive2://test.com:10000/;principal=hive/test.com@REALM.COM Connecting to jdbc:hive2://test.com:10000/;principal=hive/test.com@REALM.COM Enter username for jdbc:hive2://test.com:10000/;principal=hive/test.com@REALM.COM: Enter password for jdbc:hive2://test.com:10000/;principal=hive/test.com@REALM.COM: Connected to: Apache Hive (version 1.2.1000.2.5.3.0-37) Driver: Hive JDBC (version 1.2.1000.2.5.3.0-37) Transaction isolation: TRANSACTION_REPEATABLE_READ 0: jdbc:hive2://test.com:10000/> show databases; +----------------+--+ | database_name | +----------------+--+ | default | | moroto | | olum | +----------------+--+ 3 rows selected (2.863 seconds)
You should now connect successfully otherwise in un kerberized environment
[hive@host~]$ beeline .... ..... !connect jdbc:hive2://test.com:10000/<db>
Cheers
Created 08-08-2017 09:22 PM
There is no kerberos and ssl is not enabled for my case. Please help me
Created 08-08-2017 10:31 PM
see my response !
Created 08-08-2017 11:51 PM
It did not help me, as my trnasport mode is http. my HS2 doesn't run on 10000.
Created 08-09-2017 02:56 AM
Beeline connectivity working fine as below, if you gettitng error , kinldy share full work log for clear understanding ?
user@CENT:~> beeline SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/usr/hdp/2.3.2.0-2950/spark/lib/spark-assembly-1.4.1.2.3.2.0-2950-hadoop2.7.1.2.3.2.0-2950.jar!/org/slf4j/impl/StaticLoggerBinder.class SLF4J: Found binding in [jar:file:/usr/hdp/2.3.2.0-2950/hadoop/lib/slf4j-log4j12-1.7.10.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] Beeline version 1.2.1.2.3.2.48-5 by Apache Hive beeline> !connect jdbc:hive2://HDP(Hive server Name):10000 Connecting to jdbc:hive2://HDP:10000 Enter username for jdbc:hive2://HDP:10000: user Enter password for jdbc:hive2://HDP:10000: Password Connected to: Apache Hive (version 1.2.1.2.3.2.48-5) Driver: Hive JDBC (version 1.2.1.2.3.2.48-5) Transaction isolation: TRANSACTION_REPEATABLE_READ 0: jdbc:hive2://HDP:10000> use database;
Created 08-08-2017 10:04 PM
Here is a coonect string I just created in a non kerberized cluster.
Assumptions
hive host=bombay.new.com Default port = 10000 Hive database= hive Hive user =hive Hive password =hive
Here you go
[hive@bombo ~]$ beeline WARNING: Use "yarn jar" to launch YARN applications. Beeline version 1.2.1.2.3.6.0-3796 by Apache Hive beeline> !connect jdbc:hive2://bombay.new.com:10000/hive Connecting to jdbc:hive2://bombay.new.com:10000/hive Enter username for jdbc:hive2://bombo.new.com:10000/hive: hive Enter password for jdbc:hive2://bombo.new.com:10000/hive: **** Connected to: Apache Hive (version 1.2.1.2.3.6.0-3796) Driver: Hive JDBC (version 1.2.1.2.3.6.0-3796) Transaction isolation: TRANSACTION_REPEATABLE_READ 0: jdbc:hive2://bombo.uganda.com:10000/hive> show databases; +----------------+--+ | database_name | +----------------+--+ | default | +----------------+--+ 1 row selected (5.577 seconds) 0: jdbc:hive2://bombo.uganda.com:10000/hive>
So you should have a successful login
Created 08-09-2017 06:03 AM
Here are the different methods to connect.
Assumptions:
HS2 Host(s): test01.com and test02.com HS2 Binary Port: 10010 HS2 HTTP Port: 10011 ZooKeeper Quorom: test01.com:2181,test02.com:2181:test03.com:2181 HttpPath: cliservice HS2 ZooKeeper Namespace: hiveserver2 User: hiveuser Password: hivepswd
NOTE: <db> is the database in the examples below and is optional. The leading slash '/' is required. WARNING: When using 'beeline' and specifying the connection url (-u) at the command line, be sure to quote the url.
Direct - Binary Transport Mode
beeline -n hiveuser -p hivepswd -u "jdbc:hive2://test01.com:10010/<db>"
Direct - HTTP Transport Mode
beeline -n hiveuser -p hivepswd -u "jdbc:hive2://test01.com:10011/<db>;transportMode=http;httpPath=cliservice"
ZooKeeper - Binary Transport Mode
beeline -n hiveuser -p hivepswd -u "jdbc:hive2://test01.com:2181,test02.com:2181,test03.com:2181/<db>"
ZooKeeper - Http Transport Mode
beeline -n hiveuser -p hivepswd -u "jdbc:hive2://test01.com:2181,test02.com:2181,test03.com:2181/<db>;transportMode=http;httpPath=cliservice"
Alternate Connectivity
Thru Knox
jdbc:hive2://<knox_host>:8443/;ssl=true;sslTrustStore=/var/lib/knox/data/security/keystores/gateway.jks;trustStorePassword=<password>?hive.server2.transport.mode=http;hive.server2.thrift.http.path=gateway/<CLUSTER>/hive
Hope that helps
Created 08-10-2017 10:58 AM
I updated the thread did you check it out ?
Created 08-30-2018 03:07 PM
Hi All,
In my case, i have configured my cluster with Kerberos, SSL & set the hive transport mode to http. Could you please let me know how the connection string should look like?
I'm using the below connection string but still getting the same "HTTP Response code: 401 (state=08S01,code=0)" error:
Note: I do have a valid kerberos ticket for accessing the service.
# beeline -u "jdbc:hive2://xxx.xxx.local:10001/;principal=hive/xxx.xxx.local@xxx.LOCAL;ssl=true;sslTrustStore=/opt/hdp/security/pki/certs-new/jks/truststore.jks;trustStorePassword=changeit;transportMode=http;httpPath=cliservice"
Connecting to jdbc:hive2://xxx.xxx.local:10001/;principal=hive/xxx.xxx.local@xxx.LOCAL;ssl=true;sslTrustStore=/opt/hdp/security/pki/certs-new/jks/truststore.jks;trustStorePassword=changeit;transportMode=http;httpPath=cliservice 18/08/30 13:11:33 [main]: ERROR jdbc.HiveConnection: Error opening session org.apache.thrift.transport.TTransportException: HTTP Response code: 401 at org.apache.thrift.transport.THttpClient.flushUsingHttpClient(THttpClient.java:262) at org.apache.thrift.transport.THttpClient.flush(THttpClient.java:313) at org.apache.thrift.TServiceClient.sendBase(TServiceClient.java:73) at org.apache.thrift.TServiceClient.sendBase(TServiceClient.java:62) at org.apache.hive.service.cli.thrift.TCLIService$Client.send_OpenSession(TCLIService.java:158) at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:150) at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:622) at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:221) at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:208) at org.apache.hive.beeline.DatabaseConnection.connect(DatabaseConnection.java:146) at org.apache.hive.beeline.DatabaseConnection.getConnection(DatabaseConnection.java:211) at org.apache.hive.beeline.Commands.connect(Commands.java:1204) at org.apache.hive.beeline.Commands.connect(Commands.java:1100) 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 org.apache.hive.beeline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:54) at org.apache.hive.beeline.BeeLine.dispatch(BeeLine.java:998) at org.apache.hive.beeline.BeeLine.initArgs(BeeLine.java:717) at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:779) at org.apache.hive.beeline.BeeLine.mainWithInputRedirection(BeeLine.java:493) at org.apache.hive.beeline.BeeLine.main(BeeLine.java:476) 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 org.apache.hadoop.util.RunJar.run(RunJar.java:233) at org.apache.hadoop.util.RunJar.main(RunJar.java:148) Error: Could not establish connection to jdbc:hive2://xxx.xxx.local:10001/;principal=hive/xxx.xxx.local@xxx.LOCAL;ssl=true;sslTrustStore=/opt/hdp/security/pki/certs-new/jks/truststore.jks;trustStorePassword=changeit;transportMode=http;httpPath=cliservice: HTTP Response code: 401 (state=08S01,code=0) Beeline version 1.2.1000.2.6.5.0-292 by Apache Hive 0: jdbc:hive2://xxx.xxx.local:10001/ (closed)>