2881099 / FreeRedis

🦄 FreeRedis is .NET40+ redis client. supports cluster, sentinel, master-slave, pub-sub, lua, pipeline, transaction, streams, client-side-caching, and pooling.
MIT License
920 stars 164 forks source link

集群环境,高压环境下,报MOVED错误 #161

Open Yuyg77 opened 1 year ago

Yuyg77 commented 1 year ago

freeredis版本:1.1.5 .netcore版本:6.0 问题描述:集群模式,高压环境下,报MOVED错误,其余日常正常使用,不会报错 注册方式: public static void Initialization(string configString, char? splitKey = ';') { var redisConfigStrings = configString.Split(splitKey.Value); var connectionString = new List(); foreach (var item in redisConfigStrings) connectionString.Add(ConnectionStringBuilder.Parse(item)); var csRedis = new RedisClient(connectionString.ToArray()); _instance = csRedis; } 配置: xxx:xxx,password=xxxxx,maxpoolsize=200,connectTimeout=10000,idleTimeout=170000,retry=3,min poolsize=200; xxx:xxx,password=xxxx,maxpoolsize=200,connectTimeout=10000,idleTimeout=170000,retry=3,min poolsize=200; xxx:xxx,password=xxxxxx,maxpoolsize=200,connectTimeout=10000,idleTimeout=170000,retry=3,min poolsize=200

image

2881099 commented 1 year ago

slot 变动时会这样

moved 其实是重定向,目前处理机制:moved 会重试3次的,但可能仍然出错,因为 moved 到完成需要一点点时间,在这个时间空档里,是有可能3次重试都报 moved 的

解决方法:在集群上设置,让每个节点资源充足一点,尽量减少 slot 重新分配