wpdymq
Last Updated: February 25, 2016
·
16.93K
· abh1nv

Delete keys in Redis

Note: Exercise caution when using any of these.

Delete all keys in the selected database:

1) The easy way

redis-cli -n <database number> flushdb

2) The fun way

redis-cli keys ‘*’ | awk ‘{print $1}’ | xargs redis-cli DEL

Delete all keys in all databases:

redis-cli flushall

3 Responses
Add your response

1468

Or you could run the more simple redis-cli flushall; though it responds even with OK when no keys were flushed. Attention: never run this on a productive system.

over 1 year ago ·
1477

Aha! I had no idea flushall and flushdb existed. Thank you for that. I've updated the tip :)

over 1 year ago ·
11631

Thanks

over 1 year ago ·