DCS Redis Help Documentation

What Can I Do If a Lettuce 6.x Client Have Authentication Errors?

2024-05-25 03:57:21

When a Lettuce 6.x client is connected to a Redis 2.8/4.0/5.0 cluster instance, the error message "NOAUTH Authentication required" is displayed.

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 protocol (compatible with Redis versions 4 and 5) in Lettuce.

Add the following code to use the RESP2 protocol for accessing Redis:


@Configuration

public class SpringConfig implements LettuceClientConfigurationBuilderCustomizer {

    @Override

    public void customize(LettuceClientConfiguration.LettuceClientConfigurationBuilder clientConfigurationBuilder) {

        // manually specifying RESP2

        clientConfigurationBuilder.clientOptions(ClientOptions.builder()

                .protocolVersion(ProtocolVersion.RESP2)

                .build());

    }

}


h4c1V61VNI5f