Using HBase/Thrift through the Rackspace Load Balancer
Join the DZone community and get the full member experience.
Join For Freeusing the binary thrift protocol through a load balancer can be a little tricky. while it works out of the box in haproxy , you may run into some slight trouble running it through other load balancers. by default, when trying to access thrift through the rackspace cloud load balancers , you may get the following exception:
traceback (most recent call last): file "/usr/local/lib/python2.6/dist-packages/django-1.2-py2.6.egg/django/core/handlers/base.py", line 100, in get_response response = callback(request, *callback_args, **callback_kwargs) ... file "/usr/local/lib/python2.6/dist-packages/thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/protocol/tbinaryprotocol.py", line 126, in readmessagebegin sz = self.readi32() file "/usr/local/lib/python2.6/dist-packages/thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/protocol/tbinaryprotocol.py", line 203, in readi32 buff = self.trans.readall(4) file "/usr/local/lib/python2.6/dist-packages/thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/ttransport.py", line 58, in readall chunk = self.read(sz-have) file "/usr/local/lib/python2.6/dist-packages/thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/ttransport.py", line 155, in read self.__rbuf = stringio(self.__trans.read(max(sz, self.default_buffer))) file "/usr/local/lib/python2.6/dist-packages/thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/tsocket.py", line 94, in read raise ttransportexception(type=ttransportexception.end_of_file, message='tsocket read 0 bytes') thrift.transport.ttransport.ttransportexception: tsocket read 0 bytes
after playing around with the
happybase
connection
transport
settings
, i was able to rule out
framed versus binary transport
as the issue. i was also able to verify that a connection directly to the machine worked.
the issue turned out to be a setting on the rackspace load balancer.
the default tcp protocol, called simply “tcp”, did not work. by changing the setting to “tcp (client first)”, happybase was able to connect via thrift.
what does this setting do? the rackspace documentation simply says “this protocol is similiar to tcp, but is more efficient when a client is expected to write the data first”. this would seem to hint that the regular tcp option attemps to read from the server socket when a client connects, where-as as an rpc protocol, thrift expects the client to send the first data packet.
Published at DZone with permission of Chase Seibert, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Trending
-
Microservices With Apache Camel and Quarkus
-
Implementing a Serverless DevOps Pipeline With AWS Lambda and CodePipeline
-
Automating the Migration From JS to TS for the ZK Framework
-
SRE vs. DevOps
Comments