hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Saurabh Malviya (samalviy)" <samal...@cisco.com>
Subject Kerberos auth using java exception
Date Fri, 18 Mar 2016 03:33:52 GMT

Hi,

I am trying to write java code snippet to authenticate hbase using Kerberos, But I am getting
attached exception. I tried all kind of config through code but no luck.

-Saurabh
---Java Code

                HbaseGetPropertyValues properties = new HbaseGetPropertyValues();
                                             properties.getPropValues();

                                   Configuration hBaseConfig = HBaseConfiguration.create();

                                   hBaseConfig.setInt("timeout", Integer.parseInt(properties.TIMEOUT));
                                   hBaseConfig.set("hbase.zookeeper.quorum", properties.HBASE_ZOOKEEPER_QUORUM);
                                   //hBaseConfig.set("hbase.master", "hdfs-hbase-m1.insight-test-1:60000");
                                   hBaseConfig.set("hbase.zookeeper.property.clientport",
properties.HBASE_ZOOKEEPER_PROPERTY_CLIENTPORT);
                                   hBaseConfig.set("zookeeper.znode.parent", properties.ZOOKEEPER_ZNODE_PARENT);

                                  //hBaseConfig.set("hadoop.security.authentication", "kerberos");
                                   hBaseConfig.set("hbase.security.authentication", "kerberos");

                                   hBaseConfig.set("hbase.master.kerberos.principal", "test/INSIGHT@INSIGHT");
                                   hBaseConfig.set("hbase.regionserver.kerberos.principal",
"test/INSIGHT@INSIGHT");
                                   hBaseConfig.set("hbase.master.keytab.file", "/root/test.keytab");
                                   hBaseConfig.set("hbase.regionserver.keytab.file", "/root/test.keytab");

                                   //runLoginAndRenewalThread(hBaseConfig, "/root/test.keytab",
"test/INSIGHT@INSIGHT");

                                   UserGroupInformation.setConfiguration(hBaseConfig);
                                   User.login(hBaseConfig,"hbase.master.keytab.file", "hbase.regionserver.kerberos.principal",
null);
                                   //UserGroupInformation.loginUserFromKeytab("test/INSIGHT@INSIGHT","/root/test.keytab");
                                   UserGroupInformation ugi = UserGroupInformation.loginUserFromKeytabAndReturnUGI("test/INSIGHT@INSIGHT","/root/samalviy.keytab");
                                   UserGroupInformation.setLoginUser(ugi);

                                   System.out.println("getLoginUser :: "+ugi.getLoginUser());
                                   System.out.println(hBaseConfig);

                                   HBaseAdmin.checkHBaseAvailable(hBaseConfig);
                                   Connection connection = ConnectionFactory.createConnection(hBaseConfig);

Mime
View raw message