async-redis
async-redis copied to clipboard
Is clustered Redis supported?
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. 😀
Do you mean some kind of transparent connection to multiple Redis instances?
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
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.
https://github.com/socketry/protocol-redis/pull/18 introduced support for the methods.
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 feel free to contribute upstream if you think there are specific changes that would be helpful :)