Your destination for complete Tech news

How to list all databases in Redis?

1.3K 0
< 1 min read

Redis uses a database model in which you can select a database using the SELECT command. By default, Redis has 16 databases numbered from 0 to 15.

To list all the databases in Redis, you can use the “INFO” command along with “keyspace”.

$ redis-cli INFO keyspace

This command will return the information about all the databases, the output will be like:


In python redis library

import redis
r = redis.Redis()
dbs ="keyspace")

This will return a dictionary containing the information of all the databases.

Please note that the number of databases in Redis can be set in the configuration file, but the default is 16, and you can switch between them using the SELECT command by specifying the database number.

Leave A Reply

Your email address will not be published.

four × one =

This site uses Akismet to reduce spam. Learn how your comment data is processed.