我在使用Kerberos身份验证的群集中使用安全的配置单元流。
我使用hadoop:2.7.3.2.6.1.0-129 和蜂巢:1.2.1000.2.6.1.0-129
我能够通过
的kerberos id和keytab对Ugi进行身份验证ugi = UserGroupInformation.loginUserFromKeytabAndReturnUGI("user@XX.QQQ.NET", "/home/xx/user.keytab");
但稍后调用fetchTransactionBatch时,
会发生Kerberos IO故障TransactionBatch txnBatch = secureConn.fetchTransactionBatch(numTrx, writer);
代码段:
HiveEndPoint hiveEP = new HiveEndPoint(hiveConf.getVar(ConfVars.METASTOREURIS), database, table, partArray);
Configuration conf = new Configuration();
conf.set("hadoop.security.authentication", "kerberos");
System.setProperty( "java.security.krb5.conf", "//etc//krb5.conf");
UserGroupInformation ugi;
UserGroupInformation.setConfiguration(conf);
ugi = UserGroupInformation.loginUserFromKeytabAndReturnUGI("user@XX.qqq.NET", "/home/xx/user.keytab");
if (ugi==null)
{
return;
}
UserGroupInformation.setLoginUser(ugi);
StreamingConnection secureConn = hiveEP.newConnection(true, hiveConf, ugi);
int numTrx = 2;
String[] fieldNames = {"number", "name"};
boolean ifc = ugi.hasKerberosCredentials();
DelimitedInputWriter writer = new DelimitedInputWriter(fieldNames,",", hiveEP);
TransactionBatch txnBatch = secureConn.fetchTransactionBatch(numTrx, writer);
异常:TransactionBatch txnBatch = secureConn.fetchTransactionBatch(numTrx,writer);
java.lang.reflect.UndeclaredThrowableException at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1884) 在 org.apache.hive.hcatalog.streaming.HiveEndPoint $ ConnectionImpl.fetchTransactionBatch(HiveEndPoint.java:424) at ns.KClass。(KClass.java:112)at ns.KClass.main(KClass.java:45) 引起:org.apache.hive.hcatalog.streaming.StreamingIOFailure: 无法为其创建RecordUpdaterS hdfs://MAIN/hdfs/path/to/database.db/acid1 txnIds [113,114] at at org.apache.hive.hcatalog.streaming.AbstractRecordWriter.newBatch(AbstractRecordWriter.java:193)
>由以下原因引起:java.io.IOException: org.apache.hadoop.security.AccessControlException:客户端不能 通过验证:[TOKEN,KERBEROS];主机详细信息:本地主机是: " lh.net/1.2.3.4" ;;目的地主持人是:" yyy.net":8020;
有人可以告诉我如何解决此异常并获取事务批处理。
感谢。