Alibaba Cloud Redis error: Redis Error: err for redis cluster, eval/evalsha number of keys canAnalysis of T Be Negative or Zero
1. Error: Redis Error err for Redis Cluster, evalevalsha number of keys canT be negative or zero. as shown in Figure 1
Redis error: ERR for redis cluster, eval/evalsha number of keys can't be negative or zero Redis command was: EVAL local allpks=redis.call('LRANGE','ca:ar:user',0,-1) local pks={} local n=0 local v=nil local i=0 local key='ca:ar:user' for k,pk in ipairs(allpks) do if true then i=i+1 if i>0 then do return redis.call('HGETALL','ca:ar:user:a:' .. pk) end end end end return pks 0
2. Reference URL:https://developer.aliyun.com/article/645851. One of the limitations of the Lua script for the cloud Redis cluster, the call must have a key, otherwise the error message will be returned directly, “-err for redis cluster, eval/evalsha number of keys cant be negative or zerorn”.
3. Give up the use of Alibaba Cloud Redis cluster. the problem is solved. Subsequent support for the Redis cluster needs to be adjusted at the program level. as shown in Figure 3


