之前用java连接hbase是没有启动Kerberos认证,代码能连接到hbase,也能查询数据;现在启动kerberos认证后再次查询时却不能获取到数据
以下是我的代码,大牛们有知道哪儿出问题了(hbase是基于CDH5.13版本开发的)
System.setProperty("hadoop.home.dir", "/usr/hbase");
conf = HBaseConfiguration.create();
conf.set("hbase.zookeeper.property.clientPort", zkPort);
conf.set("hbase.zookeeper.quorum", zkHost);
conf.set("hbase.master", master);
conf.set("hbase.master.kerberos.principal","hbase/_HOST@TEST.COM");
conf.set("hbase.regionserver.kerberos.principal","hbase/_HOST@TEST.COM");
conf.set("hbase.security.authentication","kerberos");
conf.addResource("/usr/hbase/hbase-site.xml");
String principal = System.getProperty("kerberosPrincipal", "hbase@TEST.COM");
String keytabLocation = System.getProperty("kerberosKeytab",keyberos);
UserGroupInformation.setConfiguration(conf);
UserGroupInformation ugi = UserGroupInformation.loginUserFromKeytabAndReturnUGI(principal, keytabLocation);
ugi.reloginFromKeytab();
conn = ConnectionFactory.createConnection(conf);
问题现象:开启认证后服务器能正常启动,也不报错。但是在查询中就出现以下错误信息:
DEBUG ResultBoundedCompletionService:226 - Replica 0 returns java.net.SocketTimeoutException: callTimeout=60000,
callDuration=72022: Call to bdp02/10.127.60.2:60020 failed on local exception: javax.security.sasl.SaslException:
Failure to initialize security context [Caused by GSSException: Invalid name provided (Mechanism level: KrbException:
Cannot locate default realm)] row 'hbase_person_ecif,6610fc0ad0d6745f39310624bfe761ad,99999999999999' on
table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=bdp02,60020,1542464877235, seqNum=0
DEBUG ConnectionImplementation:911 - locateRegionInMeta parentTable=hbase:meta, metaLocation=, attempt=0 of 36 failed;
retrying after sleep of 100 because: Failed after attempts=36, exceptions:
Sat Nov 17 22:53:32 CST 2018, null, java.net.SocketTimeoutException: callTimeout=60000, callDuration=72022: Call to
bdp02/10.127.60.2:60020 failed on local exception: javax.security.sasl.SaslException: Failure to initialize security
context [Caused by GSSException: Invalid name provided (Mechanism level: KrbException: Cannot locate default
realm)] row 'hbase_person_ecif,6610fc0ad0d6745f39310624bfe761ad,99999999999999' on table 'hbase:meta' at
region=hbase:meta,,1.1588230740, hostname=bdp02,60020,1542464877235, seqNum=0
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。