Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum number of databases in redis

In redis, select "number" gives access to specific database at that index. I my redis config it is set 16(why ?). We require high scaling of our application so what is the max limit for that?

like image 589
Siva Kumar Avatar asked Apr 20 '16 06:04

Siva Kumar


People also ask

How many databases can Redis have?

Out of the box, a Redis instance supports 16 logical databases.

Can Redis have multiple databases?

Redis comes with support for multiple databases, which is very similar to the concept in SQL databases. In SQL databases, such as MySQL, PostgreSQL, and Oracle, you can define a name for your databases. However, Redis databases are represented by numbers.

Does Redis have a limit?

Redis can handle up to 2^32 keys, and was tested in practice to handle at least 250 million keys per instance. Every hash, list, set, and sorted set, can hold 2^32 elements. In other words your limit is likely the available memory in your system.

Should I use multiple Redis databases?

In practical terms, Redis databases should be used to separate different keys belonging to the same application (if needed), and not to use a single Redis instance for multiple unrelated applications. When using Redis Cluster, the SELECT command cannot be used, since Redis Cluster only supports database zero.


1 Answers

The default number of databases in Redis is 16,index:0~15。You can edit your redis.conf file to adjust this number:

Steps:

1)edit config file

vi /etc/redis.conf

Default config path is /etc/redis.conf on Centos when installed with Yum.

2)find keyword:"databases"

# Set the number of databases. The default database is DB 0, you can select
# a different one on a per-connection basis using SELECT <dbid> where
# dbid is a number between 0 and 'databases'-1
databases 16

databases 16:16 is the default on new installations

3)Update the number of databases:

databases 30

4)end,save and quit

like image 110
Jason Avatar answered Oct 25 '22 19:10

Jason