Redis Cluster?

54 views
Skip to first unread message

CmdrTallen

unread,
Nov 8, 2011, 4:36:58 PM11/8/11
to Sider + Lemonade
Hi,

How would one use sider with say a three node redis cluster?

Master -> 10.10.10.1
Slave 1 -> 10.10.10.2
Slave 2 -> 10.10.10.3

I tried setting multiple hosts values but that didnt seem to work, ie;
var client = new RedisClient("10.10.10.1,10.10.10.2");

I am trying to get the sider client to hit the next node in the
cluster if the master goes down.

Any suggestions?

Thanks!
Steven

Chakrit

unread,
Nov 9, 2011, 1:49:10 AM11/9/11
to Sider + Lemonade
Hi,


Thanks for trying out sider! :) It's been a long quiet period for this
project.
I don't really have much experience using Redis in a clustered
environment, thus the limited support.

But it's definitely doable. You will have to add a few helper methods
to rotate the cluster pools.

I have written you a sample here: https://gist.github.com/1350627

I havn't tested it though since I have my hands full right now. But
that should helps you get going.
Also you will want to turn off automatic reconnect first. (or turn
down the number of retries)

var settings = RedisSettings.Build()
.Host("10.10.10.1")
.ReconnectOnIdle(false);

var pool = new ThreadwisePool(settings);

This way when there's a downed instance the client would throws a
`TimeoutException` immediately.
And the code I gave you would retry the next host instead of the same
host.

I will see if it is not too hard to add proper clustering support to
the next version of sider.
I'm working on adding new stuff in 2.4 right now. But work always get
in the way. :(


Hope this helps!


- chakrit
Reply all
Reply to author
Forward
0 new messages