Using Redis databases

64 views
Skip to first unread message

Rohit Sodhia

unread,
May 12, 2018, 6:11:37 PM5/12/18
to Redis DB
I'm new to Redis, and I've been looking up recently whether people use different databases or namespace for different projects, and why/when. From what I can tell, database vs namespace largely comes down to choice? One thing that kinda confuses me is that databases are selected by number, not name, so that seems like it'd make it difficult to manage between databases? I'd love any advice on getting started. I have a bunch of questions, and unfortunately not quite sure where to learn from.

Rudy Jadeja

unread,
May 12, 2018, 9:47:40 PM5/12/18
to redi...@googlegroups.com
I personally have used different databases to store data that has the same key but different underlying structures.  i.e. key-1 in database 1 is a hashmap and key-1 in database 2 is a set.  Also in general most libraries you use to connect to Redis can connect to a specific database on initialization.  So you would just have two different connection objects to use throughout your application, which makes managing different databases pretty straightforward.

On Sat, May 12, 2018 at 6:00 PM, Rohit Sodhia <sodhia...@gmail.com> wrote:
I'm new to Redis, and I've been looking up recently whether people use different databases or namespace for different projects, and why/when. From what I can tell, database vs namespace largely comes down to choice? One thing that kinda confuses me is that databases are selected by number, not name, so that seems like it'd make it difficult to manage between databases? I'd love any advice on getting started. I have a bunch of questions, and unfortunately not quite sure where to learn from.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at https://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

hva...@gmail.com

unread,
May 13, 2018, 4:33:35 PM5/13/18
to Redis DB
In Redis, multiple databases appears to be an idea added in the early days of the project, but was never developed into a fully functional feature, and is not supported in the sharding version of the Redis server, named Redis Cluster.  My advice is to not use them.  Let all your keys exist in Database 0, the default.  If you want to have a Redis server machine (or group of machines in master/slave configuration) that is shared by multiple applications, use key names to keep the data separate.  And the same for a server/group that's shared among multiple environments (dev, qa, staging).
Reply all
Reply to author
Forward
0 new messages