Redis 'cluster' on developer machine

Hello,

Not to be confused with the new Cluster support in 3.0, but 3 machines that are collectively called a cluster. I posted to ServerFault the following question as I see more and more need to integrate with GCE Redis, RabbitMQ, and ServiceStack, they are perfect together. Here’s the post: http://serverfault.com/questions/692094 basically I’d like some guidance on the preferred way to set up the GCE cluster in my apphost file. This documentation can then be put on the ServiceStack Redis page here https://github.com/ServiceStack/redis-windows I’ll even update the docs if Batman can provide the know how.

-Stephen

It looks like the Windows build of Redis still doesn’t include a redis-sentinel.exe so it looks like the only way to setup redis-sentinel on Windows is to run redis-server and redis-sentinel instances in a Linux VM like Virtual Box.

I still need to do more testing around the RedisSentinel class which is why it’s still unannounced and undocumented. But basically if you’re using redis-sentinels then you would ignore the IP addresses for redis Master or Slaves as they runtime configuration of available master/slaves is now managed by the Sentinels. I’ve previously described how to initialize RedisSentinel in this earlier StackOverflow answer.

The RedisSentinelTests should also help in showing how to configure RedisSentinel.

Thanks Demis.

I have that SO post open in one monitor, another is the ServiceStack.Redis source, then finally on my third is my project, I’m still stumped. Please read my latest SO post and help me understand the correct way to get GCE and SS working together.

http://stackoverflow.com/questions/30250342/

http://stackoverflow.com/questions/30270437

Thank you,
Stephen

Whenever you see an “unknown command” exception, e.g:

unknown command ‘SENTINEL’

It means the Server you’re connecting to doesn’t support the command you’re sending, in this case the SENTINEL command should only be sent to “redis-sentinel” processes, not normal Redis Master/Slave instances which I’m assuming is what’s happening.

The default TCP port of a redis-sentinel is 26379 so you should try specifying it explicitly, e.g:

var sentinel = new RedisSentinel("sentinel.host:26379", sentinelName);

I test Redis these days and find it has “net connect issue” and other exceptions occasionally .

I find Redis has Cluster and SENTINEL feature. but i can not find documents in the SS.

  1. Could i use Cluster with SS now?
  2. Could i use SENTINEL instead of Cluster to make my Redis server stable.
    3.I think both Cluster and SENTINEL can make Redis more stable according to the blog below. And i think the biggest difference is Cluster copy data among all nodes. Am i right?
    Redis Sentinel & Redis Cluster - what?

That happens whenever there’s a network failure or when the server drops the TCP connection, there’s not much you can do to improve this other than improving your network and ensuring the redis-server has adequate memory and CPU capacity.

That’s because there’s no support for Redis Cluster and Redis Sentinel support hasn’t been announced yet, it’s currently available in v4.0.43 on MyGet and will be officially announced next release. There’s some docs I wrote earlier about RedisSentinel here: ServiceStack.Redis.Sentinel Usage - Stack Overflow there will be additional docs after it’s been announced.

  1. Could i use Cluster with SS now?

No, there’s no support for Redis Cluster.

  1. Could i use SENTINEL instead of Cluster to make my Redis server stable.

Redis Sentinel provides monitoring and automatic failover, but also requires multiple redis servers and sentinels, the Redis Sentinel Docs goes through and explains the capabilities of a number of different configurations.

But this wont make “redis more stable” it makes it “more available” in that it will monitor and automatically failover one of the replicated slaves to become the new master if it has detected the master has gone down. If anything it has the potential to cause more dropped connections if the Sentinels end up reporting more false positives.

3.I think both Cluster and SENTINEL can make Redis more stable according to the blog below. And i think the biggest difference is Cluster copy data among all nodes. Am i right?

No they’re completely different technologies. A redis master and slaves configuration on its own already fully replicates the master data to all slaves. Redis Sentinel are just extra server processes that monitor the existing (master / slaves) redis-servers.

Redis Cluster is completely different, it provides a way to shard redis data across multiple nodes, i.e. no longer is the entire redis dataset contained in a single redis-server, it’s instead sharded/split across multiple servers and has more limited functionality as a result, i.e. it only supports a single database and doesn’t do multi-key operations spanning more than a single server.

See the Redis Documentation for more details:

If you have any questions about either of them you should ask the official Redis Mailing List.

I’ve been pleased with the Sentinel Impl from before 4.0.43, and now that the ServiceStack Redis Client adheres to the official Redis Sentinel Client in the MyGet branch I feel that Demis is leading us in the right direction with Redis Sentinel support. My most current work is all on Google Compute Engine and we have numerous environments built out with a minimum of 3 Redis instances in each tier, all running Sentinel.

1 Like

I’ve implemented Auto Retry of Socket Exceptions in this commit.

By default it retries using an exponential backoff within 3s, after which it will throw a Redis TimeoutException with the InnerException holding the original Exception, the default RetryTimeout can be updated with:

RedisConfig.DefaultRetryTimeout = 5000; //5 seconds

If you were getting dropped connections before, I’d be interested to know if this helps reducing them.

This change is available from v4.0.43+ that’s now available on MyGet.