socketry / async-redis

MIT License
83 stars 18 forks source link

Is clustered Redis supported? #40

Closed travisbell closed 1 week ago

travisbell commented 2 years ago

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. 😀

ioquatix commented 2 years ago

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

travisbell commented 2 years ago

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

ioquatix commented 2 years ago

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 commented 1 year ago

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

nburwell commented 1 year ago

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.

ioquatix commented 1 year ago

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

ioquatix commented 1 week ago

This is now supported: https://github.com/socketry/async-redis/pull/52