I'm getting error while using ZRange via go-redis.
clusterOption := &redis.ClusterOptions{
DialTimeout: ev.Redis.DialTimeout,
ReadTimeout: ev.Redis.ReadTimeout,
WriteTimeout: ev.Redis.WriteTimeout,
PoolSize: ev.Redis.PoolSize,
PoolTimeout: ev.Redis.PoolTimeout,
MinIdleConns: ev.Redis.MinIdleConnections,
MaxRedirects: ev.Redis.MaxRedirects,
Addrs: []string{ev.Redis.Address},
TLSConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
},
}
redisClient := redis.NewClusterClient(clusterOption)
if err := redisClient.Ping(ctx).Err(); err != nil {
return nil, fmt.Errorf("pinging failed, %s", err.Error())
}
ids, err := redisClient.ZRange(context.Background(), "x:123", 0, -1)
There are two errors.
- redis: can't parse array/set/push reply: "$24"
- redis: invalid reply: "\r\n"
The number of elements in the sorted set is 21028 for first error and 475490 for second error.
I'm using AWS MemoryDB Redis cluster.
Number of nodes: 9
Number of shards: 3
Redis version: 7.0
Golang version: go 1.21.1
go-redis version: v9.3.0
What could be the reason?