-
Notifications
You must be signed in to change notification settings - Fork 270
[feat] support cluster and sentinel deployment for redis #270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Yeuoly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use English comments instead
|
I suggest using redis.UniversalClient because it supports direct connections, Sentinel mode, and cluster mode, which can simplify configuration management. I've created a PR at #276 to implement support for Sentinel mode. This will enable us to use Redis more reliably in the production environment. |
0c348b8 to
fba8571
Compare
|
@Yeuoly [done] convert chinese comment to english, pls check! |
|
I've reviewed #276, I prefer to use redis.UniversalClient as the client so that this is no need to maintain a interface like what you do, @chenzikun @erigo , how do you like? |
|
I suggest adding support for Redis cluster based on #276. |
|
i think sentinel mode and cluster mode of reids subpub will not work as expected. when there is a failure of a redis instance, pubsub connection of failed redis will not automatically change to another redis instance. |
|
Thanks for pointing this out — I agree with your observation that Redis Sentinel and Cluster modes do not automatically recover Pub/Sub connections after failover, which makes Redis Pub/Sub unsuitable for high-availability scenarios. However, I would respectfully disagree with the idea of “splitting the cache ability into different interfaces.” As for Pub/Sub, I agree that Redis is not the right tool for reliable messaging. For systems that depend on high-availability message delivery, dedicated message queues like Kafka or NATS are far more suitable. So in short: use redis.UniversalClient to unify caching access, but avoid Redis Pub/Sub for HA-critical workflows. |
this will make it hard to extend different caching storages. e.g. our redis cluster implemention is not opensource RedisCluster or Sentinel
agree. and it's better to split the current responsibilities of the cache into a cache interface and pubsub |
I agree splitting them into different interfaces would make cache more extendable, but just at this point, Redis is the production standard for almost all the software, adding support for other cache is not a priority I guess |
fba8571 to
8953de4
Compare
|
@Yeuoly ok.I had change my code.redis cluster base on redis.UniversalClient, pls check! |
|
Hi👋 , I tried UniversalClient and UniversalClient, but got the following error while running Is this related to this func Sorry, I'm not very familiar with the Redis API. |
|
@zhuzihao-hz @chenzikun 定位到 redis.go 文件 Transaction方法里面的报错位置为: 高版本的redis,比如:go-redis v9.5.x ,Watch() 方法源码中仍然保留以下判断逻辑 |
请问你能提供更多的上下文吗,我这边未出现你说情况,这种是集群模式导致的,还是redis本身存在这种错误;我这边可以修改Transaction这个函数,但是太确认是否会引起其他问题,因为我没有办法在所有的环境中验证。 |
3bd17fb to
0d2966b
Compare
fixed this error! |
|
@Yeuoly pls review this feature |
feature-redis cluster & sentinel
fix #147