我正在尝试使用rJava和rstudio如下连接到apache配置单元:
library(rJava)
library(RJDBC)
library("DBI")
options(java.parameters = '-Xmx8g')
hadoop_jar_dirs <- c('/hadoop/common/','/hadoop/apache-hive-3.1.0-bin/lib/')
clpath <- c()
for (d in hadoop_jar_dirs) {
clpath <- c(clpath, list.files(d, pattern = 'jar', full.names = TRUE))
}
.jinit(classpath = clpath)
.jaddClassPath(clpath)
hive_jdbc_jar <- c('/hadoop/lib/hive-jdbc-3.1.0.jar')
hive_driver <- c('org.apache.hive.jdbc.HiveDriver')
hive_url <- c('jdbc:hive2://localhost:10000/default','user','passed')
drv <- JDBC(hive_driver, hive_jdbc_jar)
conn <- dbConnect(drv, hive_url)
我收到此错误:
018-10-02T13:29:06,804 WARN [main] org.apache.hive.jdbc.HiveConnection - Failed to connect to <server>:10000
Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1], :
java.sql.SQLException: Could not open client transport with JDBC Uri: jdbc:hive2://<server>:10000/default: Failed to open new session: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: <user> is not allowed to impersonate anonymous
2018-10-02T13:29:06,886 WARN [main] org.apache.hive.jdbc.HiveConnection - Failed to connect to <server>:10000
我已按照以下建议更新了core-site.xml文件:
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/hadoop/data/hadoop_tmp_data/</value>
</property>
<property>
<name>hadoop.proxyuser.<user>.groups</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.<user>.hosts</name>
<value>*</value>
</property>
</configuration>
当我在服务器上时,我可以进入配置单元提示符并发出类似命令
显示表格; 显示数据库;
有什么想法吗?