因为公司需求要开发一个数据质量监控的组件,需要连接集群上的hive,impala。
1集群采用了kerbores认证,报了第一个错误
通过java访问带有kerbores认证的impala,hive
这是由于没有配置kerbores
2参考了网上的一块代码,连接带有认证的hbase的代码
通过java访问带有kerbores认证的impala,hive

   System.setProperty("java.security.krb5.conf","E:\\learning\\aaaa.keytab");
    HiveConf conf = new HiveConf();
    conf.set("hadoop.security.authentication","Kerberos");
    conf.set("keytab.file","E:\\learning\\aaaa.keytab");
    conf.set("kerberos.principal","aaaa/[email protected]");
    UserGroupInformation.setConfiguration(conf);

在集群中找到自己需要的用户对应的kerbores凭证,下载下来,但是又报错了

Exception in thread "main" java.lang.IllegalArgumentException: Can't get Kerberos realm
	at org.apache.hadoop.security.HadoopKerberosName.setConfiguration(HadoopKerberosName.java:65)
	at org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation.java:323)
	at org.apache.hadoop.security.UserGroupInformation.setConfiguration(UserGroupInformation.java:378)
	at com.example.SpringBootDemo.service.ImpalaTest.main(ImpalaTest.java:17)
Caused by: java.lang.reflect.InvocationTargetException
	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.security.authentication.util.KerberosUtil.getDefaultRealm(KerberosUtil.java:84)
	at org.apache.hadoop.security.HadoopKerberosName.setConfiguration(HadoopKerberosName.java:63)
	... 3 more
Caused by: KrbException: Cannot locate default realm
	at sun.security.krb5.Config.getDefaultRealm(Config.java:1029)
	... 9 more

暂时没解决

相关文章:

  • 2021-11-23
  • 2021-05-18
  • 2022-12-23
  • 2020-12-18
  • 2021-08-17
  • 2021-11-27
  • 2022-12-23
猜你喜欢
  • 2021-10-29
  • 2021-05-18
  • 2022-12-23
  • 2021-10-15
  • 2021-07-09
  • 2022-02-18
  • 2021-04-01
相关资源
相似解决方案