async-redis icon indicating copy to clipboard operation
async-redis copied to clipboard

Is clustered Redis supported?

Open travisbell opened this issue 3 years ago • 6 comments

Hey Samuel, I couldn't quite glean this from the docs or any of the tests but is Redis Cluster supported?

I've been working to integrate more Async into my projects but use clusters for a lot of my Redis workloads.

Thanks for all the work you're doing in this area. 😀

travisbell avatar Feb 09 '22 18:02 travisbell

Do you mean some kind of transparent connection to multiple Redis instances?

ioquatix avatar Feb 10 '22 04:02 ioquatix

Sort of, but more specifically, I mean Redis' actual cluster functionality. Basically, this:

  • https://github.com/redis/redis-rb/blob/master/cluster/lib/redis/cluster.rb
  • https://github.com/redis/redis-rb/tree/master/cluster

travisbell avatar Feb 10 '22 15:02 travisbell

I see.

It should be in https://github.com/socketry/protocol-redis/tree/master/lib/protocol/redis/methods

I see the auto-generation method mentions cluster support, but it looks like we haven't generated it. Our interface code is generated from the Redis structured documentation automatically.

We should also add some explicit support for this.

We did some work previously to support Redis sentinels: https://github.com/socketry/async-redis/pull/29

It uses a different client because that's the key differentiation. I believe we should then wrap the internal implementation so for the most part it's hidden within the transaction layer.

ioquatix avatar Feb 13 '22 20:02 ioquatix

https://github.com/socketry/protocol-redis/pull/18 introduced support for the methods.

ioquatix avatar Jun 13 '23 15:06 ioquatix

Thanks for merging that @ioquatix ! Our company uses AWS ElasticCache with redis in clustered mode for one of our services, and we are in the process of switching over to Ruby 3 + Async + AsyncRedis, and it's working well to use this gem (we had opened up some of the Protocol classes to extend the logic ourselves initially).

For reference @travisbell , we're on a forked version of https://github.com/zhchsf/redis_cluster for the clustering logic itself, but we now instantiate instances of Async::Redis::Client for talking to the nodes.

nburwell avatar Jun 14 '23 21:06 nburwell

@nburwell feel free to contribute upstream if you think there are specific changes that would be helpful :)

ioquatix avatar Jun 14 '23 23:06 ioquatix