Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create own database in redis?

Tags:

redis

There are 0 to 15 databases in redis.  

I want to create my own database using redis-cli. Is there any command for it?

like image 525
user3612181 Avatar asked Feb 25 '16 07:02

user3612181


People also ask

Can we create database in Redis?

You don't create a database in Redis with a command - the number of databases is defined in the configuration file with the databases directive (the default value is 16). To switch between the databases, call SELECT . Save this answer.

Can I use Redis instead of database?

Redis is a data structure store that can be used as a database, cache, or even a message broker. The storage structure is both open-source and in-memory. It is also NoSQL-based. This means it allows data structures like strings, hashes, lists, sets, sorted sets of data, bit maps, and so on.

Is Redis database free?

You can use the full capabilities of Redis Enterprise Software, but you cannot deploy it to production. It allows a maximum of four shards and does not provide the same support options as the paid version. The free version has a 14 day time limit, after which no more configuration changes can be done.


2 Answers

Redis database is not an equivalent of database names in DBMS like mysql. It is a way to create isolation and namespacing for the keys, and only provides index based naming, not custom names like my_database.

By default, redis has 0-15 indexes for databases, you can change that number databases NUMBER in redis.conf.

And then you use SELECT command to select the database you want to work on.

like image 117
DhruvPathak Avatar answered Sep 24 '22 19:09

DhruvPathak


You don't create a database in Redis with a command - the number of databases is defined in the configuration file with the databases directive (the default value is 16). To switch between the databases, call SELECT.

like image 34
Itamar Haber Avatar answered Sep 22 '22 19:09

Itamar Haber