Read more

Delete specific Redis-DBs

Stefan Xenopol
January 17, 2023Software engineer at makandra GmbH

To delete a specific redis-DB you need to use the FLUSHDB-command in combination with the SELECT-command. For more information have a look at the documentation for FLUSHDB Show snapshot and SELECT Show snapshot .


By default when connecting to a redis-instance you always connect with db0.

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show snapshot

When connecting to the db you can list your keyspaces/databases with:

# Show info about all databases> INFO keyspace
# Keyspace

In this example you can see that we have 3 DBs.

If you are unsure which DB you want to remove have a look at the keys in the databases by selecting the database and then listing all keys.

# Select db1> SELECT 1

# List all keys[1]> KEYS *
[possibly long output or "empty list or set"]

In order to delete the keys you need to select the DB first and then remove all keys using FLUSHDB


If you are using a redis cluster this will delete the database across all nodes in your cluster.

# Select db1> SELECT 1

# If possible, check if keys can be really deleted[1]> KEYS *

# Remove all keys[1]> FLUSHDB

# Double check if all keys are gone[1]> KEYS *
(empty list or set)
Stefan Xenopol
January 17, 2023Software engineer at makandra GmbH
Posted by Stefan Xenopol to makandra Operations (2023-01-17 16:22)