适用于某些客户端的迁移指南
如果您使用的是 Go-Redis v9 或 Lettuce v6+(默认情况下切换到 RESP3 协议),并且您正在运行 Redis 堆栈命令,请确保在升级到 Redis 版本 7.2 之前将协议版本固定到 RESP2。
Go-Redis 餐厅
对于使用 Go-Redis v9 及以上版本的应用程序,请确保您拥有 Go-Redis v9.0.5 及以上版本,并固定协议版本,如下所示:
client := redis.NewClient(&redis.Options{
Addr: "<database_endpoint>",
Protocol: 2, // Pin the protocol version
})
No actions are required for applications using Go-Redis v8 or earlier.
Lettuce
To pin the protocol version, use the snippet below:
import io.lettuce.core.*;
import io.lettuce.core.api.*;
import io.lettuce.core.protocol.ProtocolVersion;
// ...
RedisClient client = RedisClient.create("<database_endpoint>");
client.setOptions(ClientOptions.builder()
.protocolVersion(ProtocolVersion.RESP2) // Pin the protocol version
.build());
// ...
If you are using LettuceMod, you need to upgrade to v3.6.0.