Cannot determine a partition to read for slot-------- springboot 项目连接Redis 集群报错

报错信息摘要提示如下:

io.lettuce.core.cluster.PartitionSelectorException:Cannot determine a partition to read for slot

原因

如提示: slot 没有重新分配到每个node节点,可能跟redis开启集群功能有关系

解决办法

  1. 检查每个节点的slot覆盖情况:
    进入redis安装目录下执行如下命令:

如出现以下结果:

Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
				>>> Performing Cluster Check (using node 10.113.197.5:6379)
				M: 87d66a4ca81b7abfd81b78bbfd2521691f9fbe09 10.113.197.5:6379
				   slots: (0 slots) master
				[OK] All nodes agree about slots configuration.
				>>> Check for open slots...
				>>> Check slots coverage...
				[ERR] Not all 16384 slots are covered by nodes.

说明该节点没有cover 所有slots 资源

  1. 修复node节点对slot资源的覆盖
    进入redis安装目录下执行如下命令:
 ./redis-cli --cluster fix IP:PORT -a password
  •  
  1. 重启项目,发现启动日志正常,没有报错

 

你可能感兴趣的:(redis,redis,java,linux)