What Can I Do If a Lettuce 6.x Client Is Incompatible with My DCS Instance?
Symptom
When a Lettuce 6.x client is connected to a Proxy Cluster DCS Redis 4.x/5.x instance, the error message "NOAUTH Authentication required" is displayed.
Analysis
In Lettuce 6.x and later versions, the HELLO command of RESP3 (introduced in Redis 6.x) is used to determine the version adaptation. Instances of earlier versions that do not support the HELLO command may encounter compatibility issues. For these instances, you can specify the RESP2 mode (compatible with Redis versions 4 and 5) in Lettuce.
Solution
Add the following code to use RESP2 protocol for accessing Redis:
package com.chinaroad.parking.config; import io.lettuce.core.ClientOptions; import io.lettuce.core.protocol.ProtocolVersion; import org.springframework.boot.autoconfigure.data.redis.LettuceClientConfigurationBuilderCustomizer; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration; @Configuration public class SpringConfig implements LettuceClientConfigurationBuilderCustomizer { @Override public void customize(LettuceClientConfiguration.LettuceClientConfigurationBuilder clientConfigurationBuilder) { // manually specifying RESP2 clientConfigurationBuilder.clientOptions(ClientOptions.builder() .protocolVersion(ProtocolVersion.RESP2) .build()); } }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.