在连接到远程HBase集群时,我可以创建Table并获取Table Listing。但是无法使用Java API扫描表。下面是代码
configuration.set("hbase.zookeeper.quorum", "QUARAM");
configuration.set("hbase.master", "MASTER");
configuration.set("hbase.zookeeper.property.clientPort", "2181");
configuration.set("hadoop.security.authentication", "kerberos");
configuration.set("hbase.security.authentication", "kerberos");
configuration.set("zookeeper.znode.parent", "/hbase-secure");
configuration.set("hbase.cluster.distributed", "true");
configuration.set("hbase.rpc.protection", "authentication");
configuration.set("hbase.regionserver.kerberos.principal", "hbase/Principal@realm");
configuration.set("hbase.regionserver.keytab.file", "/home/developers/Desktop/hbase.service.keytab3");
configuration.set("hbase.master.kerberos.principal", "hbase/HbasePrincipal@realm");
configuration.set("hbase.master.keytab.file", "/etc/security/keytabs/hbase.service.keytab");
System.setProperty("java.security.krb5.conf","/etc/krb5.conf");
String principal = System.getProperty("kerberosPrincipal", "hbase/HbasePrincipal@realm");
String keytabLocation = System.getProperty("kerberosKeytab", "/etc/security/keytabs/hbase.service.keytab");
UserGroupInformation.set configuration( configuration);
UserGroupInformation.loginUserFromKeytab(principal, keytabLocation);
UserGroupInformation userGroupInformation = UserGroupInformation.loginUserFromKeytabAndReturnUGI("hbase/HbasePrincipal@realm", "/etc/security/keytabs/hbase.service.keytab");
UserGroupInformation.setLoginUser(userGroupInformation);
我遇到了以下错误,
org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed after attempts=36, exceptions: Mon Jul 09 18:45:57 IST 2018, null, java.net.SocketTimeoutException: callTimeout=60000, callDuration=64965: row '' on table 'DEMO_TABLE' at region=DEMO_TABLE,,1529819280641.40f0e7dc4159937619da237915be8b11., hostname=dn1-devup.mstorm.com,60020,1531051433899, seqNum=526190
Exception : java.io.IOException: Failed to get result within timeout, timeout=60000ms