Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

'HTTP/1.1 400 Bad Request Connection: close' when accessing HBase on Kerberized Thrift Server

'HTTP/1.1 400 Bad Request Connection: close' when accessing HBase on Kerberized Thrift Server

New Contributor


I am trying to access HBase on a kerberized Thrift server. What I am trying to achieve is very simple, to get a list of the table names via python script.


As I can ssh to the server and list the tablenames via hbase shell, I am 100% sure that I am properly authenticated via Kerberos, because without any ticket on cache or with tickets to another realm, I simply can't access. There might be another thing to mention: as I ssh to the server, it asks for my LDAP username and password too and I provide them.


The code snippet I used is this:

thriftServer = '' #censored but a domain name like this, also tried with IP
thriftPort = 9090
saslServiceName = 'hbase'
sock = TSocket.TSocket(thriftServer, thriftPort)
transport = TTransport.TSaslClientTransport(sock, thriftServer, saslServiceName) #1
protocol = TBinaryProtocol.TBinaryProtocol(transport) #2
client = Hbase.Client(protocol) #3
print(client.getTableNames()) #4

If I use TSaslClientTransport at index #1, I receive HTTP 400 as I try opening the transport (#3). If I use TBufferedTransport or TFramedTransport instead, that line is passed! But I get HTTP 400 at index #4 instead.


Tried combinations of Buffered and Framed with Sasl too:


transport = TTransport.TSaslClientTransport(sock, thriftServer, saslServiceName)
transport = TTransport.TBufferedTransport(transport) # also tried with TFramedTransport
transport = TTransport.TBufferedTransport(sock)  # also tried with TFramedTransport
transport = TTransport.TSaslClientTransport(transport, thriftServer, saslServiceName)

and received 400 again as I try opening the transport (#3)


I also tried using CompactProtocol at index #2, and I get "Bad protocol id in the message"

(protocol_id in message: 72 / expected (default): 130)


May I ask what else I can try to make it work?


Thanks in advance

Don't have an account?
Coming from Hortonworks? Activate your account here