Bash script to Redis SCAN e.g. for pruning, migration and archiving

Posted by evan_summers on Nov 8, 2015 9:20 AM EDT
https://github.com/evanx/bashbin; By Evan Summers
Mail this story
Print this story

We document a bash script for Redis SCAN, which tries not to overwhelm our production system. This is useful for pruning, migrating keys, archiving content to disk e.g. into a pre-cache to be served directly by Nginx try_files

We should not use "redis-cli keys" - especially not on large Redis keyspaces on production machines - as this can block Redis for a number of seconds.

We document a template bash script for Redis SCAN on production machines. It ensures we don't overwhelm the system, by sleeping, especially while the load is too high.

This is useful for pruning (e.g. deleting keys according to their TTL or other logic); migrating keys to another Redis instance; archiving Redis content to a disk-based database; or extracting content to a disk pre-cache to be served directly by Nginx try_files, e.g. in perpetuity after keys have expired, or to improve resilience e.g. when our service is down or being restarted.

See https://github.com/evanx/bashbin/blob/master/redis-scan/read...

Full Story

  Nav
» Read more about:

« Return to the newswire homepage

This topic does not have any threads posted yet!

You cannot post until you login.