Support Questions

Find answers, ask questions, and share your expertise

Unable to connect to kerberized hbase in Cloudera data platform 7.4.4 using hbase-client library (JAVA)

avatar
New Contributor

hi team,

 

I'm trying to establish connection to cloudera-hbase using hbase-client library. I'm not able to establish the connection and getting the following error.
 exception: 

org.apache.hadoop.hbase.MasterNotRunningException: org.apache.hadoop.hbase.MasterNotRunningException: org.apache.hadoop.hbase.ipc.CallTimeoutException: Call to address=ip-172-1-4-7.ap-south-1.compute.internal:16000 failed on local exception: org.apache.hadoop.hbase.ipc.CallTimeoutException: Call[id=0,methodName=IsMasterRunning], waitTime=60215ms, rpcTimeout=60000ms

at org.apache.hadoop.hbase.client.ConnectionImplementation.isMasterRunning(ConnectionImplementation.java:723)

at org.apache.hadoop.hbase.client.HBaseAdmin.available(HBaseAdmin.java:2367)

at org.example.HBaseKerberos.main(HBaseKerberos.java:45)

Caused by: org.apache.hadoop.hbase.MasterNotRunningException: org.apache.hadoop.hbase.ipc.CallTimeoutException: Call to address=ip-172-1-4-7.ap-south-1.compute.internal:16000 failed on local exception: org.apache.hadoop.hbase.ipc.CallTimeoutException: Call[id=0,methodName=IsMasterRunning], waitTime=60215ms, rpcTimeout=60000ms

at org.apache.hadoop.hbase.client.ConnectionImplementation$MasterServiceStubMaker.makeStub(ConnectionImplementation.java:1359)

at org.apache.hadoop.hbase.client.ConnectionImplementation.getKeepAliveMasterService(ConnectionImplementation.java:1425)

at org.apache.hadoop.hbase.client.ConnectionImplementation.isMasterRunning(ConnectionImplementation.java:721)

... 2 more

Caused by: org.apache.hadoop.hbase.ipc.CallTimeoutException: Call to address=ip-172-1-4-7.ap-south-1.compute.internal:16000 failed on local exception: org.apache.hadoop.hbase.ipc.CallTimeoutException: Call[id=0,methodName=IsMasterRunning], waitTime=60215ms, rpcTimeout=60000ms

at org.apache.hadoop.hbase.ipc.IPCUtil.wrapException(IPCUtil.java:222)

at org.apache.hadoop.hbase.ipc.AbstractRpcClient.onCallFinished(AbstractRpcClient.java:392)

at org.apache.hadoop.hbase.ipc.AbstractRpcClient.access$100(AbstractRpcClient.java:92)

at org.apache.hadoop.hbase.ipc.AbstractRpcClient$3.run(AbstractRpcClient.java:426)

at org.apache.hadoop.hbase.ipc.AbstractRpcClient$3.run(AbstractRpcClient.java:421)

at org.apache.hadoop.hbase.ipc.Call.setTimeout(Call.java:107)

at org.apache.hadoop.hbase.ipc.RpcConnection$1.run(RpcConnection.java:134)

at org.apache.hbase.thirdparty.io.netty.util.HashedWheelTimer$HashedWheelTimeout.run(HashedWheelTimer.java:715)

at org.apache.hbase.thirdparty.io.netty.util.concurrent.ImmediateExecutor.execute(ImmediateExecutor.java:34)

at org.apache.hbase.thirdparty.io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:703)

at org.apache.hbase.thirdparty.io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:790)

at org.apache.hbase.thirdparty.io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:503)

at java.lang.Thread.run(Thread.java:750)

Caused by: org.apache.hadoop.hbase.ipc.CallTimeoutException: Call[id=0,methodName=IsMasterRunning], waitTime=60215ms, rpcTimeout=60000ms

at org.apache.hadoop.hbase.ipc.RpcConnection$1.run(RpcConnection.java:135)

... 6 more

code : 

public class HBaseKerberos{

    public static void main(String[] args) throws IOException {

        Scanner scanner = new Scanner(System.in);

        try {

            System.setProperty("sun.security.jgss.debug", "true");

            System.setProperty("sun.security.krb5.debug", "true");

            System.setProperty("sun.security.jgss.debug", "true");

            System.setProperty("javax.security.auth.useSubjectCredsOnly","false");

            System.setProperty("java.security.debug", "logincontext,policy,scl,gssloginconfig");

            Configuration config = HBaseConfiguration.create();

            config.addResource("/home/hduser/core-site.xml");

            config.addResource("/home/hduser/hbase-site.xml");

            config.addResource("/home/hduser/hdfs-site.xml");

            config.set("hadoop.security.authentication", "kerberos");

            config.set("hbase.zookeper.quorum", "ip-172-1-4-7.ap-south-1.compute.internal");

            config.set("hbase.zookeeper.property.clientPort", "2181");

            config.set("hbase.security.authentication","kerberos");

            System.setProperty("java.security.krb5.conf","/etc/krb5.conf");
            UserGroupInformation.setConfiguration(config);

            UserGroupInformation.loginUserFromKeytab("hduser@EXAMPLE.COM","/home/hduser/kerbhduser.keytab");

         
            HBaseAdmin.available(config);

            System.out.println("enter total record count");

            int count = scanner.nextInt();

            System.out.println("enter the batch size");

            int batchSize = scanner.nextInt();

            System.out.println("enter the delay for each batch");

            int delayInterval = scanner.nextInt();




            // Create connection to HBase

            Connection connection = ConnectionFactory.createConnection(config);

            System.out.println("enter the table name");

            String  tableNameInput = scanner.next();

            System.out.println("enter the start positon");

            int startPos = scanner.nextInt();

            TableName table1 = TableName.valueOf(tableNameInput);

            String family1 = "customer";

            String family2 = "order";

            Admin admin = connection.getAdmin();

            Table hTable = ConnectionFactory.createConnection().getTable(table1);

            HTableDescriptor desc = new HTableDescriptor(table1);

            desc.addFamily(new HColumnDescriptor(family1));

            desc.addFamily(new HColumnDescriptor(family2));

            if(!admin.tableExists(table1)) {

                admin.createTable(desc);

            }




        }

 
I have downloaded the hbase-site.xml , core-site.xml and hdfs-site.xml from Cloudera's hbase master role.

Kindly help in this regard.

1 REPLY 1

avatar
Community Manager

@karthik_bigData Welcome to the Cloudera Community!

To help you get the best possible solution, I have tagged our HBase experts @aquilodran and @pajoshi  who may be able to assist you further.

Please keep us updated on your post, and we hope you find a satisfactory solution to your query.


Regards,

Diana Torres,
Community Moderator


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community: