I enabled Kerberos to secure hadoop and generated key tab for principal
[email protected] and provided test user RX (read execute) permission using
hbase shell -grant command when i do kinit -k -t test.keytab
[email protected]
everything works fine .I am trying to do the same thing like reading table
via Java code/Java Client using below code
System.setProperty("java.security.krb5.realm", "EXAMPLE.COM");
System.setProperty("java.security.krb5.kdc", "D-9539.kpit.com");
//System.setProperty("sun.security.krb5.debug", "true");
Configuration config = HBaseConfiguration.create();
config.set("hadoop.security.authentication", "Kerberos");
config.set("hbase.security.authentication", "kerberos");
UserGroupInformation.setConfiguration(config);
config.set("hbase.zookeeper.quorum", "D-9539.kpit.com");
config.setInt("zookeeper.recovery.retry",1);
config.set("zookeeper.znode.parent","/hbase-secure");
config.set("hbase.client.retries.number", Integer.toString(2));
config.set("zookeeper.session.timeout", Integer.toString(60000));
UserGroupInformation userGroupInformation =
UserGroupInformation.loginUserFromKeytabAndReturnUGI("[email protected]",
"D:\\mohanv.keytab" );
//UserGroupInformation userGroupInformation =
UserGroupInformation.loginUserFromKeytabAndReturnUGI("[email protected]",
"/Users/guest/Work/workspace/hbase.headless.keytab" );
UserGroupInformation.setLoginUser(userGroupInformation);
Connection conn = ConnectionFactory.createConnection(config);
TableName tablename=TableName.valueOf("tweetTest2");
Table table = conn.getTable(tablename);
Get get=new Get(Bytes.toBytes("row1")) ;
get.addFamily(Bytes.toBytes("twt"));
System.out.println(Bytes.toString(table.get(get).getRow()));
But getting
*org.apache.hadoop.hbase.client.RetriesExhaustedException:*
and then
*clientClosingConnectionException*
--
View this message in context:
http://apache-hbase.679495.n3.nabble.com/Unable-to-connect-to-Hbase-when-Kerberos-Enabled-tp4079897.html
Sent from the HBase User mailing list archive at Nabble.com.