TRYAGAIN Multiple keys request during rehashing of slot: Multiple keys request during rehashing of slot (cluster)(槽重新哈希期间的多键请求)
Redis含义
在 Redis Cluster 中,当某个哈希槽正在节点之间迁移(rehashing/resharding)时,发出了包含属于同一槽的多个键的请求,而其中部分键已迁移、部分尚未迁移。服务器要求您稍后重试该操作。
原因
在槽迁移进行期间运行多键命令(MGET、MSET、多键 Lua、事务)。在迁移中的槽里,部分键位于源节点、部分位于目标节点,因此命令无法以原子方式执行。
解决方法
在客户端捕获此错误并稍等后重试(TRYAGAIN 是暂时性的;重新分片完成后即消失)。对于多键操作,用哈希标签保证所有键位于同一槽中,例如 {app_user123}.profile、{app_user123}.settings。在低流量时段执行集群再平衡(重新分片)。
同一数据库的其他条目
- ERR MULTI calls can not be nestedMULTI calls can not be nested(MULTI 调用不能嵌套)
- ERR Lua script attempted to access nonexistent global variableLua script attempted to access a nonexistent global variable(Lua 脚本试图访问不存在的全局变量)
- ERR unknown commandUnknown command(未知命令)
- ERR DISCARD without MULTIDISCARD without MULTI(未执行 MULTI 就调用 DISCARD)
- BUSYGROUP Consumer Group name already existsConsumer group already exists(消费者组已存在)
- NOGROUP No such key or consumer groupNo such key or consumer group in stream(stream 中不存在该键或消费者组)
- NOTBUSY No scripts in execution right nowNo scripts in execution right now(当前没有正在执行的脚本)