Search code examples
redisluaredis-cli

Can I run Redis CLI command line options from the Lua API?


I want to run redis-cli --bigkeys on my Redis cluster to evaluate the memory usage, and perform a SCAN across the key space to trigger an active expiry.

However, for permissions reasons I only have access to run commands via the Lua API.

Is it possible to access the redis-cli options via Lua scripts or are they only available directly from the command line?


Solution

  • No. Base on two reasons:

    1. This lua will block your redis server. The redis-cli --bigkeys will periodically invoke scan and then shoot type and memory usage towards each key and analyze. But lua will run to complete.
    2. Tedious work for you to implement the logic of findBigKeys function in lua, in spite of that you need to deal with each nodes.

    I wonder what type of permission reason stops you to invoke redis-cli --bigkeys.