Skip to content

Instantly share code, notes, and snippets.

@inakivb
Last active October 16, 2017 09:20
Show Gist options
  • Save inakivb/b3782b38a02b7bc8b8f78b2e0e7f4dd2 to your computer and use it in GitHub Desktop.
Save inakivb/b3782b38a02b7bc8b8f78b2e0e7f4dd2 to your computer and use it in GitHub Desktop.
A COLLECTION OF REDIS-CLI COMMANDS
PRODUCTION SAFE COMMANDS
Key pattern size sum
redis-cli -n ##DATABASE_ID## -p ##REDIS_PORT## --scan --pattern "*##PATTERN##*" | xargs -L 1 redis-cli -n ##DATABASE_ID## -p ##REDIS_PORT## --raw STRLEN | awk '{s+=$1} END {print s}'
Delete key pattern
redis-cli -n ##DATABASE_ID## -p ##REDIS_PORT## --scan --pattern "*##PATTERN##*" | xargs -L 10 redis-cli -n ##DATABASE_ID## -p ##REDIS_PORT## DEL
Delete big id-based HASH
for((i=1;i<=##MAX_ID##;i+=1)); do echo "$i"; done|xargs -L 10 redis-cli -n ##DATABASE_ID## -p ##REDIS_PORT## HDEL ##HASH_NAME##
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment