Support Questions
Find answers, ask questions, and share your expertise

Could not connect to Hive RJCDB with Kerberos

Could not connect to Hive RJCDB with Kerberos

New Contributor

I want to get a large table from an Hive2/Hadoop cluster with R.

I'n not quite sure on the values that I have to fill. On Cloudera WorkBench, we don't need to do a kinit to get our ticket.

 

 

cdsw@myMachine:~$ klist
Ticket cache: FILE:/tmp/krb5cc_8536
Default principal: MYUSER@AAA.COM
Valid starting     Expires            Service principal
02/05/20 15:45:12  02/06/20 01:45:12  krbtgt/BBB.COM@AAA.COM
        renew until 02/12/20 15:45:09

 

 

 

So I have a valid ticket. Now here what I have for my code in CDSW (R):

 

 

library(DBI)
library(rJava)
library(RJDBC)

# Loading Hive2 driver from cloudera
driver <- JDBC('org.apache.hive.jdbc.HiveDriver',
            classPath = list.files("/opt/cloudera/parcels/CDH-5.13.3-1.cdh5.13.3.p0.2/jars/",pattern="jar$",full.names=T),
            identifier.quote="`")

HOSTNAME <- "my.super.host.from.aws.my-company.com"
PORT <- 10000

server <- sprintf("jdbc:hive2://%s:%s/default;principal=hive/BBB.COM@AAA.COM", HOSTNAME, PORT)

conn <- dbConnect(driver, server, "", "") # No user/password

 

 

I get This error:

INFO jdbc.Utils: Supplied authorities: my.super.host.from.aws.my-company.com:10000

INFO jdbc.Utils: Resolved authority: my.super.host.from.aws.my-company.com:10000

ERROR transport.TSaslTransport: SASL negotiation failure

javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)]

 

 

Here is what I'm unsure of, is my server variable correct? Did I mess up the REALM?

 

 

"jdbc:hive2:/my.super.host.from.aws.my-company.com:10000/default;principal=hive/BBB.COM@AAA.COM"

 

 

Maybe i'm missing something, i've also tried using AuthMech=1;KrbRealm=AAA.COM;KrbHostFQDN=BBB.COM;KrbServiceName=hive instead of principal=hive, but no success.

 

Other Info, the Java version : 

 

 

$JAVA_HOME = /usr/java/jdk1.8.0_121-cloudera