I've been playing with redis (and add some fun with it) during the last fews days and I'd like to know if there is a way to empty the db (remove the sets, the existing key....) easily.
During my tests, I created several sets with a lot of members, even created sets that I do not remember the name (how can I list those guys though ?).
Any idea about how to get rid of all of them ?
open your Redis cli and There two possible option that you could use:
FLUSHDB - Delete all the keys of the currently selected DB. FLUSHALL - Delete all the keys of all the existing databases, not just the currently selected one.
Be careful here.
FlushDB deletes all keys in the current database while FlushALL deletes all keys in all databases on the current host.
tldr: flushdb
clears one database and flushall
clears all databases
Delete default or currently selected database (usually `0) with
redis-cli flushdb
Delete specific redis database with (e.g. 8
as my target database):
redis-cli -n 8 flushdb
Delete all redis databases with
redis-cli flushall
There are right answers but I just want to add one more option (requires downtime):
Source: Stackoverflow.com