Search code examples
javahbasecloudera

HBase java error - Expected HEADER=HBas but received HEADER=\x00\x00\x01\x0B


I'm trying to connecting to a remote hbase from a java application.

The remote hbase version is 2.1.0, such as my local hbase-client.

The code is working well with another cloudera environment, the only difference is that this environment is protected with kerberos, but I get login successfull in the log.

In the RpcServer log I found "Expected HEADER=HBas but received HEADER=\x00\x00\x01\x0B from :61866".

I can't find any on internet and I don't know what to check.

Any help on what should I check?


Solution

  • Online I found only old or wrong configuration.

    This one is the only that worked for me:

    org.apache.hadoop.conf.Configuration configuration = HBaseConfiguration.create();
    configuration.set("hbase.zookeeper.quorum", "server1, server2, server3");
    configuration.set("hbase.zookeeper.property.clientPort", "2181");
    configuration.set("hadoop.security.authentication","kerberos");
    configuration.set("hbase.security.authentication","kerberos");
    configuration.set("hbase.cluster.distributed", true);
    configuration.set("hbase.rpc.protection","authentication"); // Check this on your hbase configuration
    configuration.set("hbase.regionserver.kerberos.principal", "hbase/_HOST@yourdomain");
    configuration.set("hbase.master.kerberos.principal","hbase/_HOST@yourdomain");
    UserGroupInformation.setConfiguration(configuration);         
    UserGroupInformation.loginUserFromKeytab(youruser, "src/main/resources/key.keytab");