0

I am using redis to store some key/value(s) using HSET. Here is an example command I am using.

hset user name1 aa 
hset user name2 bb 
...

I'll try redis cluster, how to keep data storing in different nodes?

kaka123
  • 3
  • 4
  • You should use HMSET command, if you want to set multiple fields in hash. HSET can be used to set only one field. So in your example if name1 and name2 are fields, the correct command should be: hmset user name1 aa name2 bb .. – georgeliatsos Mar 07 '17 at 10:23

2 Answers2

0

You might find this useful: https://redis.io/topics/cluster-spec#keys-distribution-model.

Carl Dacosta
  • 873
  • 4
  • 13
0

In Redis Cluster nodes don't proxy commands to the right node in charge for a given key, but instead they redirect clients to the right nodes serving a given portion of the key space
Common approach is to keep within curly braces {user}. Hash of user is redirected to the same node

Srini Sydney
  • 564
  • 8
  • 17