lettuce
lettuce copied to clipboard
Lettuce cannot refresh cluster topology when one node disconnected
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
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.
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.
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