Search code examples
bashredisredis-cli

redis-cli "Error: Server closed the connection" when requesting lots of keys


for some reason running command KEYS command on result with millions of keys result in 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

I guess there is some timeout limit or something, how can I adjust it?


Solution

  • solution was to move from KEYS to redis-cli --scan --pattern <pattern>