An application using Spring Data Redis to connect to a Valkey cluster may experience connection failures after a primary node failure and replica promotion. The connection does not recover automatically, and functionality is only restored after restarting the application.
Symptoms:
Project: Spring Data Redis
Spring Data Redis cluster refresh is not explicitly enabled via the adaptive cluster state variable.
application.yml file to include the adaptive refresh settings:spring:
data:
redis:
cluster:
nodes:
- valkey-node-1:6379
- valkey-node-2:6379
- valkey-node-3:6379
lettuce:
cluster:
refresh:
# Re-fetches the cluster state when errors occur
adaptive: true
# Periodically re-fetches cluster topology to ensure it stays up to date
period: 30s