1、报错背景
Springboot项目在单redis切换到集群redis的时候报错:
io.lettuce.core.cluster.PartitionSelectorException: Cannot determine a partition to read for slot 10089.
2、报错原因
自然是集群redis的节点有问题,需要重新刷新一下节点的信息,大部分情况需要修理一下。
3、解决办法(一)
#节点检查,每个节点都进行检查
./redis-cli --cluster check xxx.xxx.xxx.xxx:6379 -a 123456
#节点修复,建议每个节点都进行修复
./redis-cli --cluster fix xxx.xxx.xxx.xxx:6379 -a 123456
节点修复过程中会弹出如下确认信息:
Fix these slots by covering with a random node? (type 'yes' to accept):
输入yes重新分配slots即可。
4、解决办法(二)
如果第三步如果并没有解决的话,就需要接入每个节点进行重置之后再试。
#清理重置每个节点
#连接节点
./redis-cli -h 10.19.128.135 -p 6380
#密码授权
auth 123456
#设置可写(非必要)
config set slave-read-only no
#清理并重置节点
flushall
cluster reset
解决Springboot项目中遇到的Redis集群PartitionSelectorException错误
文章讲述了在Springboot应用从单Redis迁移到集群Redis时遇到的PartitionSelectorException错误。报错原因是集群节点问题,需要检查和修复Redis集群节点,包括使用`redis-cli--clustercheck`和`--clusterfix`命令。如果这些方法无效,可能需要对每个节点执行清理和重置,包括flushall和clusterreset操作来重置节点状态。
1万+

被折叠的 条评论
为什么被折叠?



