Maximum number of DB in Redis

14,389 views
Skip to first unread message

Peter

unread,
Mar 7, 2011, 3:46:30 PM3/7/11
to Redis DB
Hi,
Could anyone tell me what the maximum number of database in Redis is?
I use Redis-2.2.2 and I set the number of databases in redis.conf as
follows.

databases 120

However, if I select database number greater than 16, there is an
error message.

redis> select 17
(error) ERR invalid DB index

It seems to me that Redis does not allow more than 17 databases (0 to
16)

Thanks,
Peter

Raffaele Sena

unread,
Mar 7, 2011, 4:02:45 PM3/7/11
to redi...@googlegroups.com
yap! I think 16 is the magic number (it was last time I checked :)

-- Raffaele


--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.


Tang Daogang

unread,
Mar 7, 2011, 8:18:29 PM3/7/11
to redi...@googlegroups.com
Can anyone give answer?
--
Nothing is impossible.

Pieter Noordhuis

unread,
Mar 8, 2011, 2:58:46 AM3/8/11
to redi...@googlegroups.com
Redis supports as many databases as you want. Did you restart your
Redis instance (or pointed it at the configuration file when you
started it, for that matter) after editing the configuration?

Please keep in mind that the use of multiple databases is discouraged.
If you're using it for separating data for a single app, you can use
regular namespacing on the keys. If you're using it to separate data
from multiple apps, you could consider running a Redis server per
application instead of many applications using the same Redis server
(since Redis has a very small memory footprint when is has no data,
~1MB).

Cheers,
Pieter

Peter

unread,
Mar 8, 2011, 10:41:06 AM3/8/11
to Redis DB
Hi Pieter,

On Mar 8, 3:58 am, Pieter Noordhuis <pcnoordh...@gmail.com> wrote:
> Redis supports as many databases as you want. Did you restart your
> Redis instance (or pointed it at the configuration file when you
> started it, for that matter) after editing the configuration?

Yes, I did change the redis.conf file, but forgot to point the redis-
server to it. I thought that the redis.conf file is load automatically
but I was wrong. It works now

> Please keep in mind that the use of multiple databases is discouraged.
> If you're using it for separating data for a single app, you can use
> regular namespacing on the keys. If you're using it to separate data
> from multiple apps, you could consider running a Redis server per
> application instead of many applications using the same Redis server
> (since Redis has a very small memory footprint when is has no data,
> ~1MB).

Thank you for the nice trick.

Best,
Peter

Peter

unread,
Mar 8, 2011, 10:43:42 AM3/8/11
to Redis DB

Hi Pieter,

On Mar 8, 3:58 am, Pieter Noordhuis <pcnoordh...@gmail.com> wrote:
> Redis supports as many databases as you want. Did you restart your
> Redis instance (or pointed it at the configuration file when you
> started it, for that matter) after editing the configuration?

Thank you for pointing it out. I thought that the redis.conf will be
loaded automatically but I was wrong.
It works now


> Please keep in mind that the use of multiple databases is discouraged.
> If you're using it for separating data for a single app, you can use
> regular namespacing on the keys. If you're using it to separate data
> from multiple apps, you could consider running a Redis server per
> application instead of many applications using the same Redis server
> (since Redis has a very small memory footprint when is has no data,
> ~1MB).

yiftach shoolman

unread,
Mar 8, 2011, 12:28:52 PM3/8/11
to redi...@googlegroups.com, Peter
Hi Pieter,

Assuming you start with a minimum memory per DB (as u mentioned), is it possible to add memory on the fly while the DB is running ?

Best,

Yiftach

Peter

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.




--
Yiftach Shoolman
+972-54-7634621

Josiah Carlson

unread,
Mar 8, 2011, 12:54:53 PM3/8/11
to redi...@googlegroups.com, yiftach shoolman, Peter
If you aren't using maxmemory settings, then Redis will use the memory
necessary to store the data you put in it. If you do use maxmemory
settings, I believe you can adjust it via the CONFIG SET commands. If
you mean something else, then you need to explain your question.

- Josiah

Elben Shira

unread,
Mar 8, 2011, 7:29:21 PM3/8/11
to redi...@googlegroups.com
Pieter,

Why is the use of multiple databases discouraged?

Josiah Carlson

unread,
Mar 8, 2011, 7:36:22 PM3/8/11
to redi...@googlegroups.com, Elben Shira
I'm not Pieter, but...

1. It adds needless complexity.
2. It will go away in the future.
3. Everything that you want to do with databases can be done via other methods.

- Josiah

On Tue, Mar 8, 2011 at 4:29 PM, Elben Shira <elben...@gmail.com> wrote:
> Pieter,
> Why is the use of multiple databases discouraged?
>

yiftach shoolman

unread,
Mar 9, 2011, 12:51:27 AM3/9/11
to redi...@googlegroups.com, Josiah Carlson, Elben Shira
Hi Josiah,

So what is the best way to support multi-tenant application over Redis ? is it just by using a different key space ?

Yiftach
--
Yiftach Shoolman
+972-54-7634621

Jeremy Zawodny

unread,
Mar 9, 2011, 1:02:04 AM3/9/11
to redi...@googlegroups.com, yiftach shoolman, Josiah Carlson, Elben Shira
Run multiple redis-server processes, one per tenet.

Jeremy

yiftach shoolman

unread,
Mar 9, 2011, 1:10:14 AM3/9/11
to Jer...@zawodny.com, redi...@googlegroups.com, Josiah Carlson, Elben Shira
As far as I remember, the optimal configuration (performance wise) is:
  # of redis servers = # of cores / 2

Assuming I want to support thousands of tenants and to use as less as possible instances/VMs/HW.

How all this works together ?

Yiftach  
--
Yiftach Shoolman
+972-54-7634621

Jeremy Zawodny

unread,
Mar 9, 2011, 1:22:11 AM3/9/11
to yiftach shoolman, redi...@googlegroups.com, Josiah Carlson, Elben Shira
There's a good chance that, like many multi-tenet systems, you'll find that the bulk of the load is generated by a very few of them.  I suspect that unless you know your tenets very well (and know that they'll be very active), you shouldn't worry as much about optimal performance.

Jeremy

Ramya Thulasingam

unread,
Dec 18, 2013, 3:57:13 PM12/18/13
to redi...@googlegroups.com
Hi Peter,

I am running into the same issue. I changed the redis.conf file to have 16 databases and later restarted the redis instance but i still get the same error when i run the specs. Can you let me know how to point the redis instance to the conf file.

Thanks
Ramya

Josiah Carlson

unread,
Dec 18, 2013, 5:08:31 PM12/18/13
to redi...@googlegroups.com
I'm not Peter, but you need to run "redis-server <name of configuration file>".

 - Josiah


--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.

To post to this group, send email to redi...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages