由于某些原因,在包含数百万个键的结果上运行命令KEYS
,结果是Error: Server closed the connection
。
[nir]$ echo "keys abc" | redis-cli -h $redis
1) "abc"
[nir]$ echo "keys a*"| redis-cli -h $redis
Error: Server closed the connection
我猜是有超时限制之类的,我该怎么调整呢?
解决方案是从KEYS
转移到redis-cli --scan --pattern <pattern>