Try this way:
Connection connection = ugi.doAs(new PrivilegedAction<Connection>() { @Override public Connection run() { return ConnectionFactory.createConnection(configuration); } }); R.C ________________________________ From: Lalit Jadhav <lalit.jad...@nciportal.com> Sent: 10 July 2018 16:35:15 To: user@hbase.apache.org Subject: Re: Unable to read from Kerberised HBase Code Snipper: Configuration configuration = HBaseConfiguration.create(); 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); Connection connection = ConnectionFactory.createConnection(configuration); Any more logs about login failure or success or related? - No, I only got above logs. On Tue, Jul 10, 2018 at 1:58 PM, Reid Chan <reidddc...@outlook.com> wrote: > Any more logs about login failure or success or related? > > And can you show the code snippet of connection creation? > ________________________________ > From: Lalit Jadhav <lalit.jad...@nciportal.com> > Sent: 10 July 2018 16:06:32 > To: user@hbase.apache.org > Subject: Re: Unable to read from Kerberised HBase > > Table only contains 100 rows. Still not able to scan. > > On Tue, Jul 10, 2018, 12:21 PM anil gupta <anilgupt...@gmail.com> wrote: > > > As per error message, your scan ran for more than 1 minute but the > timeout > > is set for 1 minute. Hence the error. Try doing smaller scans or > increasing > > timeout.(PS: HBase is mostly good for short scan not for full table > scans.) > > > > On Mon, Jul 9, 2018 at 8:37 PM, Lalit Jadhav <lalit.jad...@nciportal.com > > > > wrote: > > > > > While connecting to remote HBase cluster, I can create Table and get > > Table > > > Listing. But unable to scan Table using Java API. Below is code > > > > > > 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.loginUserFromKeytabAndReturnUG > > > I("hbase/HbasePrincipal@realm", > > > "/etc/security/keytabs/hbase.service.keytab"); > > > UserGroupInformation.setLoginUser(userGroupInformation); > > > > > > I am getting bellow errors, > > > > > > 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 > > > > > > > > > -- > > > Regards, > > > Lalit Jadhav > > > Network Component Private Limited. > > > > > > > > > > > -- > > Thanks & Regards, > > Anil Gupta > > > -- Regards, Lalit Jadhav Network Component Private Limited.