[R] Connecting to Hive in Kerberos enabled hadoop cluster from R
Kumar, Anoop (GE Corporate, consultant)
anoop.kumar1 at ge.com
Wed May 25 15:40:47 CEST 2016
Hi All,
Request your help.
We are trying to connect to hive from R using Rstudio. Its a kerberos secured cluster. Code snippet is below.
==============
library(rJava)
library(RJDBC)
cp = c("/usr/hdp/2.3.2.0-2950/hive/lib/hive-jdbc.jar","/usr/hdp/2.3.2.0-2950/hadoop/lib/hadoop-common-2.7.1.2.3.2.0-2950.jar")
.jinit(classpath=cp)
drv <- JDBC("org.apache.hive.jdbc.HiveDriver",classPath = list.files("/usr/hdp/2.3.2.0-2950/hadoop/lib",pattern="jar$",full.names=T, recursive = TRUE),identifier.quote="`")
conn <- dbConnect(drv, "jdbc:hive2://host.node1.com:10000/default;principal=hive/shost.node1.com at node1.com<mailto:shost.node1.com at node1.com>", "", "")
show_databases <- dbGetQuery(conn, "show databases")
show_databases
==============
But we are getting the below error
Error in .jcall(drv at jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1], :
java.lang.NoClassDefFoundError: Could not initialize class org.apache.hadoop.security.UserGroupInformation
What are we missing here? A kerberos ticket is there in place. Shall we usekerberos keytab inside R code? What is the function for ir. Also which hadoop libraries should we import for R and hive interaction?
Thanks & Regards,
Anoop Kumar K M
More information about the R-help
mailing list