How many Redis instances per machine?

1,885 views
Skip to first unread message

Dinos

unread,
Jul 5, 2012, 4:00:48 AM7/5/12
to redi...@googlegroups.com
Hello everybody,

I am doing my internship in a company and more specifically I am substituting the memcache of the current system, plus some data that are now stored in MySQL, in order to perform faster complicated queries. I am using 2 Redis instances, one that is taking the part of memcache +some functionality that I couldn't have in memcache and a second one that is storing some data in sets and it is used for some complicated queries that they need lots of expensive joins in MySQL.
Everything went fine locally(where I can do whatever I want with Redis) so a few weeks ago they asked me to create a prototype in the dev server. The second step went also good and now there are serious thoughts in to using Redis in production. Now I am facing some questions that I cannot answer so I would need your help. The application might have many instances (as it can be customized for every client) that they used a different MySQL database. The same happened in the development server where there might be many test applications. With MySQL was easy to have many databases but I am not sure of how many Redis instances can have considering that every application "customized copy" has to use 2 Redis instances. 

Saradhi Indurthi

unread,
Jul 5, 2012, 4:59:15 AM7/5/12
to redi...@googlegroups.com
Hi Dinos
Two ways to achieve your requirement:
1. Have multiple redis instances run on the same machine on different ports.

You can run multiple redis instances on the same machine, each
instance listening on a different port. Open redis.conf and search for
port. Create a separate conf file for each instance and specify a
different port number in each conf file. You may have to give the name
of the corresponding config file as a config parameter while starting
redis-server(s).

Each client application will have to "connect" to the specified redis
instance on the assigned port.

2. Have multiple databases on the same instance.

Redis supports multiple databases, by default 16. Please go through
the below link to get more information
http://rediscookbook.org/multiple_databases.html

In this case each application "selects" the right database after
connecting to the same server, similar to the mysql way.

Regards
Saradhi
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/redis-db/-/juPBnSo40YEJ.
> 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.

Josiah Carlson

unread,
Jul 5, 2012, 12:47:43 PM7/5/12
to redi...@googlegroups.com
If the OP does this, also remember to give each dump/AOF a different
name and/or path. It would be awful to lose data by having dumps
overwriting each other.

- Josiah

Sergei Tulentsev

unread,
Jul 6, 2012, 1:29:51 AM7/6/12
to redi...@googlegroups.com
Yes! Happened to me a couple of times :)
--
Best regards,
Sergei Tulentsev

Dinos

unread,
Jul 6, 2012, 3:53:13 AM7/6/12
to redi...@googlegroups.com
Thanks for the quick replies.
I wouldn't have thought for the dump overwrite...

>> For more options, visit this group at
>> http://groups.google.com/group/redis-db?hl=en.
>
> --
> 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+unsubscribe@googlegroups.com.

> For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
>

--
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+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.

Reply all
Reply to author
Forward
0 new messages