-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
JedisCluster didn't reconnect with new IP when domain changes #2907
Comments
Well...after searching the PR for a while, I find @yangbodong22011 has already create the PR #2643. I'm not clear enough about the discussion under pr but is there any smooth way for client users to recover their clients except for restarting ? @sazzad16 |
@mrpre Is it possible to recreate JedisCluster when you're rebuilding Redis? #2643 does address your issue but it would break many/most existing applications. We're trying to find a solution without breaking but this is taking some time. We'd welcome any PR regarding this. PS: Exact version helps better than "Latest". |
@sazzad16 Hi, i think JedisClsuter should stick to this principle: as long as user-configured Therefore, in
I think it's a background behavior that won't break the user's existing program, can you be specific about your concerns? |
@yangbodong22011 Let's consider a cluster with master nodes M1, M2, M3 and their respective replicas R1, R2, R3. We provide [M1] as startNodes in JedisCluster. Now, if M1 goes down, the entire JedisCluster would be unusable because it would try to connect only through startNodes which contains only one node M1 which is unavailable. getShuffledNodesPool() approach would not fail in this scenario. I hope this clarifies. |
@sazzad16 Thanks for your explanation.
These two orders cannot be reversed, otherwise the previous problem will still exist. |
Users don't know when they should recreate JedisCluster(when "connect refused" happen?) or it's too costly for user to code. It is preferred such |
@yangbodong22011 I was thinking about having modes for the users to choose from. Something like:
|
@sazzad16 I think this background behavior can be done correctly without burdening the user with choices. Let's keep simple. |
@yangbodong22011 I meant |
Do you mean to add EDIT:I think |
@yangbodong22011 Yes. |
@sazzad16 OK , back to the topic |
@yangbodong22011 Or, simply, we can start with first two. We'll see later about others. |
I insist that this strategy should not be exposed to users, we just need to do it silently. This strategy doesn't make sense to users and only confuses them. Also, no Redis client exposes such a policy. Lettuce provides Refresh the cluster topology view for the user to choose, call |
@yangbodong22011 Sorry, I'm missing what you're meaning by "this". Also, if I'm not mistaken, Lettuce provides many options. |
"this" means multiple modes. I think we should only support one correct mode, Currently I think it is: yes, lettuce provides many options, but it doesn't give the user the option to choose |
@dengliming thoughts? |
Hey. Sorry for the late reply. IMO I agree with @yangbodong22011. Providing more |
@dengliming Which order do you prefer? I think doing |
Just a naming opinion. never mind : ) Agree with |
There won't be any naming as there won't be multiple modes 😃 |
@yangbodong22011 Would you like to work on this? |
Of course, I will continue to modify #2643 . |
Resolved by #2643 |
@sazzad16 @yangbodong22011 seeing that this PR didn't require a lot of changes, but it fixes a huge problem - are there any chances for backporting this, for a previous jedis version, which doesn't require Spring 3.x? |
@sazzad16 I'm sure there will be, going forward for most teams this will be an issue, especially considering k8s usage and considering that upgrading to Spring Boot 3.x isn't straight forward. Can we be proactive here and do it straight away? I'd volunteer if needed. |
@sazzad16 @yangbodong22011 Actualy, I just tried this out with Spring Boot Maybe I missunderstood this issue and the PR in the first place, but what I'm trying to accomplish is to have jedis re-discover redis nodes, after those nodes' IPs change. What I'm doing and seeing is the following:
Did I miss something? Was this supposed to be solved, or it was some other problem? |
@eldarj This issue is related to Cluster but yours is related to Sentinel. |
Okay, I'll have to check why would Cluster be any different from Sentinel If you can point me in the right direction, that would be great. Why are these two different? @sazzad16 Also, if the same needs to be implemented for Sentinel, do you guys accept PR contributions, or should I create a separate issue then? |
@eldarj I couldn't find a direct comparison in redis site. Here are two separate links from there:
Coming to the comparison, there are resources available elsewhere online. For example: Hope these help.
Yes, of course.
This helps to attract more eyes and may lead to resolve it faster and/or more efficiently. |
@eldarj This is a closed state, you can open a new issue to let the problem continue, in the new issue, please note:
|
Expected behavior
I use the domain not the IP of Redis Server as parameter of JedisCluster
But when the Redis is rebuilt and it's ip changes, It seems that the JedisCluster isn't reconfigured by the new ip.
Actual behavior
User must restart the client manually even the server has recovered.
Typically, more and more Servers run on Kubernetes as
POD
and POD's IP can be changed easilySteps to reproduce:
Redis / Jedis Configuration
Jedis version:
Latest
Redis version:
6.0
Java version:
8
The text was updated successfully, but these errors were encountered: