Hi Sean,
thanks for your answer!

> I believe it may still be possible for the node to be selected if no other
> connections are available in the pool, because the logic used to establish a
> new connection might not use the filter.

My problem is not to avoid that a node will be selected again after a
fail (well, if this can be avoided by sure it's better...) but to set
an order in the nodes: I want to connect first to the node on which my
app is running and only in case of fail to the other nodes. The reason
is to avoid network traffic: every instance of my app have to connect
to the node on the same machine where it resides.
How can I suggest a "preferred node" to RiakClient?
My first idea was to use a connection with only the preferred node
and, using a try/except, use an "emergency connection" with the list
of all nodes to be used only in case of fail. But it's not so
elegant....
Massimiliano

2014-02-08 13:47 GMT+01:00 Sean Cribbs <s...@basho.com>:
> Hi Massimilliano,
>
> The list of nodes does not imply an order of connection. Usually, a random
> node is chosen after nodes with error rates greater than a threshold are
> removed from the candidates. You can see the implementation in
> RiakClient._choose_node:
> https://github.com/basho/riak-python-client/blob/master/riak/client/__init__.py#L278
>
> When a request fails such that the connection is known to be bad (such as a
> TCP error), the retry logic filters out that node from existing connections.
> I believe it may still be possible for the node to be selected if no other
> connections are available in the pool, because the logic used to establish a
> new connection might not use the filter. I will investigate further and
> determine if this is actually the case.
>
>
> On Sat, Feb 8, 2014 at 1:03 PM, Massimiliano Ciancio
> <massimili...@ciancio.net> wrote:
>>
>> Hi all,
>> I'm using python client to connect to a five nodes riak server.
>> Since I'm running my app on the same servers on which is running Riak,
>> I want that the app on server x get and store data asking to the Riak
>> on the same server. If the Riak on the same server is not available,
>> tha app must connect to another Riak server randomly choosed.
>> How can I implement this?
>> Does the list of nodes passed to the RiakClient
>> (http://basho.github.io/riak-python-client/client.html) imply an
>> 'order of connection' ? That is, first connect to the first node then,
>> if this fails, connect to the second and so on...
>> Thanks in advance
>> Massimiliano
>>
>> _______________________________________________
>> riak-users mailing list
>> riak-users@lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
>
>
> --
> Sean Cribbs <s...@basho.com>
> Software Engineer
> Basho Technologies, Inc.
> http://basho.com/

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to