Python client: Error while using Protocol Buffer Interface

Dan Reverri dan at basho.com
Thu Apr 7 12:53:49 EDT 2011


The protocol buffers API operates over a different port. Check the
app.config file of each Riak node for the pb_port parameter to find out what
port each node is listening on. You'll need to update your HAProxy config to
load balance the pb_ports.

Thanks,
Dan

Daniel Reverri
Developer Advocate
Basho Technologies, Inc.
dan at basho.com


On Thu, Apr 7, 2011 at 7:24 AM, Ishwar <ishwarsridharan at yahoo.com> wrote:

> Hello Riak folks,
>
> We have a 3-node riak cluster on my local box with haproxy load balancer
> running on port 9190 for the riak cluster. I've attached the haproxy conf
> file for your reference.
>
> We use riak-python-client to connect to Riak. While connecting through the
> HTTP interface, the riak client works fine. When I try to connect through
> the Protocol Buffer Interface, it throws exception.
>
> Here's an excerpt from the code:
>     def get(self, keys):
>         #client = riak.RiakClient()
>         client = riak.RiakClient(port=9190,
> transport_class=riak.RiakPbcTransport)
>         bucket = client.bucket('test1')
>         ret = {}
>         try:
>             for key in keys:
>                 post = bucket.get(key)
>                 ret[key] = post.get_data()
>             return ret
>         except Exception, e:
>             print  traceback.format_exc()
>             return False
>
> and here's the stack trace.
> Traceback (most recent call last):
>   File "/home/ishwar/workspace/TestRiak/src/HelloWorld.py", line 22, in get
>     post = bucket.get(key)
>   File
> "/usr/local/lib/python2.6/dist-packages/riak-1.2.1-py2.6.egg/riak/bucket.py",
> line 245, in get
>     return obj.reload(r)
>   File
> "/usr/local/lib/python2.6/dist-packages/riak-1.2.1-py2.6.egg/riak/riak_object.py",
> line 290, in reload
>     Result = t.get(self, r, vtag)
>   File
> "/usr/local/lib/python2.6/dist-packages/riak-1.2.1-py2.6.egg/riak/transports/pbc.py",
> line 157, in get
>     msg_code, resp = self.recv_msg()
>   File
> "/usr/local/lib/python2.6/dist-packages/riak-1.2.1-py2.6.egg/riak/transports/pbc.py",
> line 349, in recv_msg
>     self.recv_pkt()
>   File
> "/usr/local/lib/python2.6/dist-packages/riak-1.2.1-py2.6.egg/riak/transports/pbc.py",
> line 401, in recv_pkt
>     format(len(self._inbuf), self._inbuf_len))
> RiakError: 'Socket returned short packet 135 - expected 1213486160'
>
> Is this a problem with my haproxy config file or is there something wrong
> with riak settings? I'd be glad to share the output of logs if needed.
> --
> Thanks for the help.
> Ishwar
>
> Just another resurrected Neozoic Archosaur comics.
> http://www.flickr.com/photos/mojosaurus/sets/72157600257724083/
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110407/287f4797/attachment.html>


More information about the riak-users mailing list