lettuce icon indicating copy to clipboard operation
lettuce copied to clipboard

Lettuce cannot refresh cluster topology when one node disconnected

Open stillerrr opened this issue 2 years ago • 4 comments

Bug Report

Lettuce cannot refresh cluster topology when one node disconnected

Redis Cluster : 3 masters and 3 slaves, 3 hosts

the RedisFuture timeout is set to 2s, I shutdown one of cluster host.

then the client don't refresh the topology and still request the fail nodes

Environment

  • Lettuce version(s): 5.3.0.RELEASE
  • Redis version: 4.0.11

Possible Solution

the host do not restart so the client cannot connect to the fail node. it would block request

maybe the 2s timeout is too small to make sure lettuce trigger PERSISTENT_RECONNECTS

Additional context

stillerrr avatar Sep 16 '21 09:09 stillerrr

I'm experiencing the same behaviour when I'm sending messages to a pub/sub channel. I just see that client is trying to reconnect - Unknown Host Exception is thrown and the client cannot send any new message even Redis reports cluster state: ok.

Environemnt

  • Spring Boot 2.5.0
  • Lettuce version: 6.1.6.RELEASE
  • Redis version: 6.2.6
  • Client and Redis nodes are running as separate docker containers.

apolo-11 avatar Feb 11 '22 08:02 apolo-11

My problem has fixed after setting:

spring.redis.lettuce.cluster.refresh.period=60s
spring.redis.lettuce.cluster.refresh.adaptive=true

It takes some while but then, clients are able to send messages to the channel again.

apolo-11 avatar Feb 11 '22 13:02 apolo-11

it is too frequently to refresh topology. lettuce topology refresh would send "cluster nodes" command to all the cluster nodes, once you have a lot of client like 100 clients, you will find the cluster nodes cpu usage are very high

stillerrr avatar Mar 30 '22 12:03 stillerrr